public ActionResult Create(string entity) { var item = (ProjectInfo)JsonConvert.DeserializeObject(entity, typeof(ProjectInfo)); _iProjectInfoService.Save(null, item); _unitOfWork.Commit(); return(Content("True")); }
public ActionResult Edit(Guid?id, ProjectInfo item) { if (!ModelState.IsValid) { Edit(id); return(View(item)); } _iProjectInfoService.Save(id, item); //清除原有用户数据关联 _iProjectUserService.Delete(a => a.ProjectInfoId.Equals(item.Id) && !a.Follow); if (item.ProjectUsersId != null) { foreach (var sysUserId in item.ProjectUsersId) { _iProjectUserService.Save(null, new ProjectUser { ProjectInfoId = item.Id, Leader = item.LeaderUserId.Any(a => a == sysUserId), SysUserId = sysUserId }); _iMessenger.SendMessage(sysUserId, "加入项目:<a href='" + Url.Action("Details", "MyParticipateWork", new { item.Id }) + "' data-ajax=\"true\" data-ajax-mode=\"replace\" data-ajax-update=\"#Main\" >" + item.ProjectName + "</a>"); } } _iProjectUserService.Save(null, new ProjectUser { ProjectInfoId = item.Id, SysUserId = _iUserInfo.UserId, Leader = true }); _unitOfWork.Commit(); return(RedirectToAction("Index")); }