public IHttpActionResult PutRoomReservation_RoomDetails(int id, RoomReservation_RoomDetails club)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != club.Id)
            {
                return BadRequest();
            }


            try
            {
                _RoomReservation_RoomDetailsService.Update(club);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RoomReservation_RoomDetailsExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
            public object BindModel(
                ControllerContext controllerContext,
                ModelBindingContext bindingContext,
                MemberDescriptor memberDescriptor)
            {
                List<RoomReservation_RoomDetailsViewDetail> res = new List<RoomReservation_RoomDetailsViewDetail>();
                var form = controllerContext.HttpContext.Request.Form;
                int i = 0;
                while (!string.IsNullOrEmpty(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomTypeId"]))
                {
                    var model = new RoomReservation_RoomDetailsViewDetail();
                    var Wing = new Wing();
                    
                    var RoomReservation_RoomDetails = new RoomReservation_RoomDetails();
                    if (! string.IsNullOrEmpty (form["RoomReservation_RoomDetailsViewModel["+i+"].RoomReservation_RoomDetails.Id"]))
                        RoomReservation_RoomDetails.Id = long.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.Id"]);

                    RoomReservation_RoomDetails.RoomTypeId = int.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomTypeId"]);
                    RoomReservation_RoomDetails.RoomAllocationId = int.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomAllocationId"]);
                    RoomReservation_RoomDetails.Rate = decimal.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.Rate"]);
                    RoomReservation_RoomDetails.Total = decimal.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.Total"]);
                    RoomReservation_RoomDetails.GST_Rate = decimal.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.GST_Rate"]);
                    RoomReservation_RoomDetails.GST_Charges = decimal.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.GST_Charges"]);
                    if (! string.IsNullOrEmpty (form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomReservation_Id"]))
                        RoomReservation_RoomDetails.RoomReservation_Id = long.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].RoomReservation_RoomDetails.RoomReservation_Id"]);
                    Wing.Id = int.Parse(form["RoomReservation_RoomDetailsViewModel[" + i + "].Wing.WingId"]);


                    model.Wing = Wing;
                    model.RoomReservation_RoomDetails = RoomReservation_RoomDetails;
                    
                    res.Add(model);
                    i++;
                }

                return res;
             
        }
Exemplo n.º 3
0
        public async Task<RoomReservation_RoomDetails> getCalculateRoomPrice(int roomtypeid, DateTime checkin_datetime, DateTime checkout_datetime,int Bookingfor)
        {

            RoomRate rate = await _RoomRateRepository.GetbyRoomTypeId(roomtypeid, Bookingfor);
            decimal totalroomprice=  rate.RoomRate1 *   checkout_datetime.Subtract (checkin_datetime).Days;
            RoomReservation_RoomDetails roomdetail = new RoomReservation_RoomDetails();
            roomdetail.Rate = rate.RoomRate1;
            roomdetail.Total = totalroomprice;
           //things to do : 1. Get gst rate and gst total


            return roomdetail;
        
        }
              public async Task<JsonResult> getCalculateRoomPrice(int roomtypeid, DateTime checkin_date, DateTime checkout_date, int Bookingfor, DateTime checkin_datetime, DateTime checkout_datetime)
    {

        RoomRate rate = await _RoomRateRepository.GetbyRoomTypeId(roomtypeid, Bookingfor);
        decimal totalroomprice = rate.RoomRate1 * checkout_date.Subtract(checkin_date).Days;
        RoomReservation_RoomDetails roomdetail = new RoomReservation_RoomDetails();
        roomdetail.Rate = rate.RoomRate1;
      
        //things to do : 1. Get gst rate and gst total

        IEnumerable<Billing_Rules> billingrules = await _Billing_RulesRepository.GetBilling_Rules(checkin_datetime.ToString(datetimeformat), checkout_datetime.ToString(datetimeformat));
            decimal extraamount=0;
            if (billingrules != null)
            {
                foreach (var rule in billingrules)
                {
                    extraamount += rule.Charges * rate.RoomRate1;

                }
            }
            var roomdetailnotification = new RoomReservation_RoomDetailsNotificationViewModel();
            if (extraamount != 0)
            {
                

                roomdetailnotification.Notification = "Check/Checkout rules applied in room total and facilities";
                roomdetailnotification.IsNotify = true;
            }
        roomdetail.Total = extraamount + totalroomprice;

        var roominfo = new RoomReservation_RoomDetailsMasterObject() { Notification = roomdetailnotification, RoomReservation_RoomDetails = roomdetail };
        return Json(roominfo);

    }
        public IHttpActionResult PostRoomReservation_RoomDetails(RoomReservation_RoomDetails club)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            _RoomReservation_RoomDetailsService.Create(club);

            return CreatedAtRoute("DefaultApi", new { id = club.Id }, club);
        }
 public RoomReservation_RoomDetailsViewDetail()
 {
     RoomReservation_RoomDetails = new RoomReservation_RoomDetails();
     Wing = new Wing();
 }