public ActionResult HallAllocation() { _viewModel = new SetupViewModel(); _staffHallLogic = new StaffHallLogic(); try { ViewBag.Halls = _viewModel.HallSelectList; ViewBag.Staff = _viewModel.HallStaffSelectList; _viewModel.StaffHallList = _staffHallLogic.GetAll(); } catch (Exception) { throw; } return(View(_viewModel)); }
public JsonResult AllocateHall(int hallId, long staffId) { JsonResponseModel result = new JsonResponseModel(); try { if (hallId > 0 && staffId > 0) { _staffHallLogic = new StaffHallLogic(); STAFF_HALL existingStaffHall = _staffHallLogic.GetEntitiesBy(c => c.Hall_Id == hallId).LastOrDefault(); if (existingStaffHall == null) { existingStaffHall = new STAFF_HALL(); existingStaffHall.Hall_Id = hallId; existingStaffHall.Staff_Id = staffId; _staffHallLogic.Create(existingStaffHall); } else { existingStaffHall.Staff_Id = staffId; _staffHallLogic.Modify(existingStaffHall); } result.IsError = false; result.Message = "Operation Successful!"; } else { result.IsError = true; result.Message = "Invalid parameter"; } } catch (Exception ex) { result.IsError = true; result.Message = ex.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }