예제 #1
0
        public JsonResult OtherChargesAction(int id, bool isAddOtherCharges = false, decimal amount = 0, string details = null)
        {
            JsonResult json            = new JsonResult();
            var        result          = false;
            var        additionalfeeid = 0;

            if (id > 0 && isAddOtherCharges == true)
            {
                try
                {
                    //add other charges here
                    BookingAdditionalFee bookingAdditionalFee = new BookingAdditionalFee()
                    {
                        BookingId = id,
                        Name      = details,
                        Fee       = amount,
                        Status    = 1
                    };

                    additionalfeeid = bookingService.AddOtherCharges(bookingAdditionalFee);
                    if (additionalfeeid > 0)
                    {
                        result = true;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }


            if (id > 0 && isAddOtherCharges == false)
            {
                try
                {
                    result = bookingService.UpdateAddionalChargesStatus(id, 0);
                }

                catch (Exception)
                {
                    throw;
                }
            }

            if (result)
            {
                json.Data = new { success = true, msg = "success", data = additionalfeeid };
            }
            else
            {
                json.Data = new { success = false, Messag = "Unable to Perform Operation in Booking." };
            }
            return(json);
        }