public void EditMeetingRoomBooking(MeetingRoomBookingInfo mrbInfo) { MeetingRoomBooking mrb = _context.MeetingRoomBooking.Find(mrbInfo.ID); mrb.Title = mrbInfo.Title; mrb.Description = mrbInfo.Description; mrb.MeetingRoomID = mrbInfo.MeetingRoomID; mrb.StartTime = mrbInfo.StartTime; mrb.EndTime = mrbInfo.EndTime; mrb.OwnerID = mrbInfo.OwnerID; _context.Entry(mrb).State = EntityState.Modified; _context.SaveChanges(); }
public void SaveMeetingRoomBooking(MeetingRoomBookingInfo mrbInfo) { MeetingRoomBooking mrb = new MeetingRoomBooking() { Title = mrbInfo.Title, Description = mrbInfo.Description, MeetingRoomID = mrbInfo.MeetingRoomID, StartTime = mrbInfo.StartTime, EndTime = mrbInfo.EndTime, OwnerID = mrbInfo.OwnerID }; _context.MeetingRoomBooking.Add(mrb); _context.SaveChanges(); }
public JsonResult SaveMRB(string mrbJsonStr, bool isEdit) { LoginUser loginUser = (LoginUser)Session["CurrentLoginUser"]; MeetingRoomBookingInfo mrbInfo = JsonConvert.DeserializeObject <MeetingRoomBookingInfo>(mrbJsonStr); mrbInfo.StartTime = mrbInfo.StartTime.ToLocalTime(); // convert UAT to Local Time because of JSON.stringify convert the datetime object to UAT mrbInfo.EndTime = mrbInfo.EndTime.ToLocalTime(); // convert UAT to Local Time because of JSON.stringify convert the datetime object to UAT mrbInfo.OwnerID = loginUser.UserId; if (isEdit) { new MeetingRoomBookingManager().EditMeetingRoomBooking(mrbInfo); } else { new MeetingRoomBookingManager().SaveMeetingRoomBooking(mrbInfo); } return(Json("success", JsonRequestBehavior.AllowGet)); }