public async Task <ActionResult> ContributeDelete(Guid id) { var contributeService = new ContributeService(); await contributeService.RemoveContribute(id); return(RedirectToAction(nameof(ContributeList))); }
public async Task <ActionResult> ContributeDetails(Guid?id) { var contributeService = new ContributeService(); if (id == null || !await contributeService.ExistsContribute(id.Value)) { return(RedirectToAction(nameof(ContributeList))); } return(View(await contributeService.GetOneContributeById(id.Value))); }
public ActionResult CreateContribute(ContributeCreateViewModel model) { if (ModelState.IsValid) { IContributeService contributeSvc = new ContributeService(); contributeSvc.CreateContribute(model.AddPointProject, model.AddPointContent, model.AddPointMethod, model.SelfPoint, model.SelfReason, model.AuditPoint); return(RedirectToAction(nameof(ContributeList))); } ModelState.AddModelError("", @"您录入的信息有误"); return(View()); }
public async Task <ActionResult> ContributeList(int pageIndex = 1, int pageSize = 5) { //总页码、当前页码、可显示总页码 var contributeSvc = new ContributeService(); //当前第n页数据 var articles = await contributeSvc.GetAllContribute(pageIndex, pageSize, false); //总个数 var dataCount = await contributeSvc.GetDataCount(); //绑定分页 var list = new PagedList <ContributeDto>(articles, pageIndex, pageSize, dataCount); return(View(list)); }
public async Task <ActionResult> ContributeEdit(Guid id) { var contributeService = new ContributeService(); var data = await contributeService.GetOneContributeById(id); return(View(new ContributeEditViewModel() { Id = data.Id, AddPointProject = data.AddPointProject, AddPointContent = data.AddPointContent, AddPointMethod = data.AddPointMethod, SelfPoint = data.SelfPoint, SelfReason = data.SelfReason, AuditPoint = data.AuditPoint })); }
public async Task <ActionResult> ContributeEdit(Models.ContributeViewModels.ContributeEditViewModel model) { if (ModelState.IsValid) { var contributeService = new ContributeService(); await contributeService.EditContribute(model.Id, model.AddPointProject, model.AddPointContent, model.AddPointMethod, model.SelfPoint, model.SelfReason, model.AuditPoint); return(RedirectToAction(nameof(ContributeList))); } else { await new ContributeService().CreateContribute(model.AddPointProject, model.AddPointContent, model.AddPointMethod, model.SelfPoint, model.SelfReason, model.AuditPoint); return(View(model)); } }