public ActionResult SearchPreviousDelegation(EditDelegationViewModel viewmodel, int id) { string token = GetToken(); UserModel um = GetUser(); DelegationModel um1 = new DelegationModel(); try { if (viewmodel != null) { viewmodel.assignedby = um.Userid; um1.Delid = id; DelegationModel um2 = APIDelegation.GetDelegationByDeleid(token, id, out string delerror); um1.Startdate = um2.Startdate; um1.Enddate = viewmodel.EndDate; um1.Userid = um2.Userid; um1.AssignedbyId = um.Userid; um1.Active = ConDelegation.Active.ACTIVE; APIDelegation.UpdateDelegation(token, um1, out string error); } } catch (Exception ex) { return(RedirectToAction("Index", "Error", new { error = ex.Message })); } Session["noti"] = true; Session["notitype"] = "success"; Session["notititle"] = "Update Delegation"; Session["notimessage"] = "Delegation is updated successfully"; return(RedirectToAction("SearchPreviousDelegation")); }
public JsonResult CancelDelegation(int id) { string token = GetToken(); UserModel um = GetUser(); bool result = false; if (id != 0) { DelegationModel dm = APIDelegation.GetDelegationByDeleid(token, id, out string error); DelegationModel dm1 = APIDelegation.CancelDelegation(token, dm, out string cancelerror); result = true; } return(Json(result, JsonRequestBehavior.AllowGet)); }