public BookingInformations(BookingInformationsInputViewModel obj) { Email = obj.email; Address = obj.address; Reason = obj.reason; BookingRepresent = obj.bookingRepresent; Status = obj.status; CreateDate = DateTime.Now; BookingServiceType = 1; ReasonReject = obj.reasonReject; }
public IActionResult Update([FromBody] BookingInformationsInputViewModel booking) { try { _context.Session.BeginTransaction(); if (booking.reasonReject != null) { _context.Update <BookingInformations>(p => p.BookingId == booking.bookingId, a => new BookingInformations { ReasonReject = booking.reasonReject, Status = 3, }); } else { _context.Update <BookingInformations>(p => p.BookingId == booking.bookingId, a => new BookingInformations { Reason = booking.reason, Status = booking.status, BookingUser = booking.bookingUser, Address = booking.address.Trim(), UpdateDate = DateTime.Now, UpdateUserId = booking.updateUserId }); } _context.Session.CommitTransaction(); return(Json(new ActionResultDto())); } catch (Exception e) { if (_context.Session.IsInTransaction) { _context.Session.RollbackTransaction(); } return(Json(new ActionResultDto { Error = e.Message })); } }