Beispiel #1
0
        /// <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));
        }
Beispiel #2
0
        /// <summary>
        /// Get the details of the current FacilityDepartment in the view model by ID
        /// </summary>
        /// <param name="id">
        /// The identifier.
        /// </param>
        /// <returns>
        /// The <see cref="JsonResult"/>.
        /// </returns>
        public JsonResult GetFacilityDepartmentDetails(int id)
        {
            using (var bal = new FacilityDepartmentBal())
            {
                // Call the AddFacilityDepartment Method to Add / Update current FacilityDepartment
                FacilityDepartment current = bal.GetFacilityDepartmentById(id);

                // Pass the ActionResult with the current FacilityDepartmentViewModel object as model to PartialView FacilityDepartmentAddEdit
                return(this.Json(current));
            }
        }