public IActionResult EditFeature(FeatureModel model) { ViewBag.IsLogin = !string.IsNullOrEmpty(cache.GetString("user")); if (ViewBag.IsLogin) { ViewBag.User = JsonConvert.DeserializeObject <AccountModel>(cache.GetString("user")); } else { return(RedirectToAction("Login", "Account")); } if (ModelState.IsValid) { var project = projectSvc.GetProject(model.Project_id); var isValid = ValidateClosingDate(false, project, model); if (!isValid) { PrepareDataForDisplay(model.Project_id, model); return(View(model)); } if (!string.IsNullOrEmpty(model.BeAssignedMember_id)) { var memberships = membershipSvc.GetAllProjectMember(model.Project_id); var ranks = rankSvc.GetAllRank(); var member = ViewBag.User != null?memberships.FirstOrDefault(it => it.Account_id == ViewBag.User._id && !it.RemoveDate.HasValue) : null; var userRank = (ranks.FirstOrDefault(it => it._id == member.ProjectRank_id)); var canAssign = userRank.CanAssign || member.CanAssign; if (canAssign) { model.AssginByMember_id = ViewBag.User._id; } } else { model.AssginByMember_id = string.Empty; } model.ClosingDate = model.ClosingDate.AddDays(1); featureSvc.EditFeature(model); return(RedirectToAction(nameof(FeatureDetail), new { projectid = model.Project_id, featureid = model._id })); } PrepareDataForDisplay(model.Project_id, model); return(View(model)); }