public JsonResult Delete(string deptIds, string reason) { bool successStatus = false; try { successStatus = new DepartmentFacade().Delete(deptIds, reason); } catch (Exception ex) { return(this.Json("{\"Error\": \"" + ex.Message + "\"}")); } string jsonResult = "{\"Success\": \"" + successStatus.ToString() + "\"}"; return(this.Json(jsonResult)); }
public JsonResult Save(DepartmentModel model) { int newDeptId = 0; try { if (ModelState.IsValid) { if (model.OrganizationID == 0) { throw new ApplicationException("Please create organization before creating departments."); } newDeptId = new DepartmentFacade().CreateOrModify(model); } } catch (Exception ex) { return(this.Json("{\"Error\": \"" + ex.Message + "\"}")); } string jsonResult = "{\"ID\":\"" + newDeptId + "\",\"Name\": \"" + model.DepartmentName + "\"}"; return(this.Json(jsonResult)); }
private static void Main(string[] args) { var departmentFacade = new DepartmentFacade(); departmentFacade.GetDepartments(); }