-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhotel_controller.cs
More file actions
52 lines (47 loc) · 1.5 KB
/
hotel_controller.cs
File metadata and controls
52 lines (47 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ABCSales.TravelAwayDAL;
using ABCSales.TravelAwayWebApiCore.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace ABCSales.TravelAwayWebApiCore.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class BookingController : Controller
{
TravelAwayRepository repos = new TravelAwayDAL.TravelAwayRepository();
[HttpPost]
public JsonResult AddBooking(Booking booking)
{
int result = 0;
//Boolean status = false;
try
{
result = repos.AddBookingUsingUSP(booking.EmailId,booking.PackageId, booking.Place, booking.ContactNo,
booking.ResidentialAddress, (DateTime)booking.DateOfTravel, booking.Adults, booking.Children,booking.BookingStatus);
}
catch (Exception)
{
result = -99;
}
return Json(result);
}
[HttpGet]
public JsonResult GetBooking(string emailId)
{
List<TravelAwayDAL.Models.Booking> booking = new List<TravelAwayDAL.Models.Booking>();
try
{
booking = repos.GetBookings(emailId);
}
catch (Exception)
{
booking = null;
}
return Json(booking);
}
}
}