/// <summary> /// Delete the current FacilityDepartment based on the FacilityDepartment ID passed in the FacilityDepartmentModel /// </summary> /// <param name="id"> /// The identifier. /// </param> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public ActionResult DeleteFacilityDepartment(int id) { var list = new List <FacilityDepartmentCustomModel>(); using (var bal = new FacilityDepartmentBal()) { // Get FacilityDepartment model object by current FacilityDepartment ID FacilityDepartment model = bal.GetFacilityDepartmentById(id); int userId = Helpers.GetLoggedInUserId(); DateTime currentDate = Helpers.GetInvariantCultureDateTime(); int corporateid = Helpers.GetSysAdminCorporateID(); int facilityid = Helpers.GetSysAdminCorporateID(); // Check If FacilityDepartment model is not null if (model != null) { model.ModifiedBy = userId; model.ModifiedDate = currentDate; model.IsActive = false; // Update Operation of current FacilityDepartment List <FacilityDepartmentCustomModel> result = bal.SaveFacilityDepartment(model); list = bal.GetFacilityDepartmentList(corporateid, facilityid, true); // return deleted ID of current FacilityDepartment as Json Result to the Ajax Call. return(this.Json(result)); } } // Pass the ActionResult with List of FacilityDepartmentViewModel object to Partial View FacilityDepartmentList return(this.PartialView(PartialViews.FacilityDepartmentList, list)); }
/// <summary> /// Gets the facility departments. /// </summary> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public ActionResult GetFacilityDepartments(bool showInActive) { using (var bal = new FacilityDepartmentBal()) { int facilityid = Helpers.GetDefaultFacilityId(); int corporateid = Helpers.GetSysAdminCorporateID(); // Get the Entity list List <FacilityDepartmentCustomModel> list = bal.GetFacilityDepartmentList(corporateid, facilityid, showInActive); return(this.PartialView(PartialViews.FacilityDepartmentList, list)); } }
/// <summary> /// Get the details of the FacilityDepartment View in the Model FacilityDepartment such as FacilityDepartmentList, list /// of countries etc. /// </summary> /// <returns> /// returns the actionresult in the form of current object of the Model FacilityDepartment to be passed to View /// FacilityDepartment /// </returns> public ActionResult Index() { // Initialize the FacilityDepartment BAL object using (var bal = new FacilityDepartmentBal()) { int facilityid = Helpers.GetDefaultFacilityId(); int corporateid = Helpers.GetSysAdminCorporateID(); // Get the Entity list List <FacilityDepartmentCustomModel> list = bal.GetFacilityDepartmentList(corporateid, facilityid, true); // Intialize the View Model i.e. FacilityDepartmentView which is binded to Main View Index.cshtml under FacilityDepartment var viewModel = new FacilityDepartmentView { FacilityDepartmentList = list, CurrentFacilityDepartment = new FacilityDepartment() }; // Pass the View Model in ActionResult to View FacilityDepartment return(View(viewModel)); } }