/// <summary> /// Add New or Update the DashboardDisplayOrder based on if we pass the DashboardDisplayOrder ID in the DashboardDisplayOrderViewModel object. /// </summary> /// <param name="model">The model.</param> /// <returns> /// returns the newly added or updated ID of DashboardDisplayOrder row /// </returns> public ActionResult SaveDashboardDisplayOrder(DashboardDisplayOrder model) { //Initialize the newId variable var userId = Helpers.GetLoggedInUserId(); var currentDate = Helpers.GetInvariantCultureDateTime(); var list = new List <DashboardDisplayOrderCustomModel>(); //Check if Model is not null if (model != null) { var corporateid = Helpers.GetSysAdminCorporateID(); model.CorporateId = corporateid; using (var bal = new DashboardDisplayOrderBal()) { if (model.Id > 0) { } else { model.CreatedBy = userId; model.CreatedDate = currentDate; } //Call the AddDashboardDisplayOrder Method to Add / Update current DashboardDisplayOrder list = bal.SaveDashboardDisplayOrder(model); } } //Pass the ActionResult with List of DashboardDisplayOrderViewModel object to Partial View DashboardDisplayOrderList return(PartialView(PartialViews.DashboardDisplayOrderList, list)); }
/// <summary> /// Delete the current DashboardDisplayOrder based on the DashboardDisplayOrder ID passed in the DashboardDisplayOrderModel /// </summary> /// <param name="id">The identifier.</param> /// <returns></returns> public ActionResult DeleteDashboardDisplayOrder(int id) { using (var bal = new DashboardDisplayOrderBal()) { //Get DashboardDisplayOrder model object by current DashboardDisplayOrder ID var model = bal.GetDashboardDisplayOrderByID(id); var userId = Helpers.GetLoggedInUserId(); var list = new List <DashboardDisplayOrderCustomModel>(); var currentDate = Helpers.GetInvariantCultureDateTime(); //Check If DashboardDisplayOrder model is not null if (model != null) { model.IsDeleted = true; //Update Operation of current DashboardDisplayOrder list = bal.SaveDashboardDisplayOrder(model); //return deleted ID of current DashboardDisplayOrder as Json Result to the Ajax Call. } //Pass the ActionResult with List of DashboardDisplayOrderViewModel object to Partial View DashboardDisplayOrderList return(PartialView(PartialViews.DashboardDisplayOrderList, list)); } }