// // GET: /FMM/Schedule/Detail public async Task <ActionResult> Detail(string key) { using (ScheduleServiceClient client = new ScheduleServiceClient()) { MethodReturnResult <Schedule> result = await client.GetAsync(key); if (result.Code == 0) { ScheduleViewModel viewModel = new ScheduleViewModel() { Name = result.Data.Key, CreateTime = result.Data.CreateTime, Creator = result.Data.Creator, Description = result.Data.Description, Editor = result.Data.Editor, EditTime = result.Data.EditTime }; return(PartialView("_InfoPartial", viewModel)); } else { ModelState.AddModelError("", result.Message); } } return(PartialView("_InfoPartial")); }
public async Task <ActionResult> SaveModify(ScheduleViewModel model) { using (ScheduleServiceClient client = new ScheduleServiceClient()) { MethodReturnResult <Schedule> result = await client.GetAsync(model.Name); if (result.Code == 0) { result.Data.Description = model.Description; result.Data.Editor = User.Identity.Name; result.Data.EditTime = DateTime.Now; MethodReturnResult rst = await client.ModifyAsync(result.Data); if (rst.Code == 0) { rst.Message = string.Format(FMMResources.StringResource.Schedule_SaveModify_Success , model.Name); } return(Json(rst)); } return(Json(result)); } }
// // GET: /FMM/ScheduleDetail/ public async Task <ActionResult> Index(string scheduleName) { using (ScheduleServiceClient client = new ScheduleServiceClient()) { MethodReturnResult <Schedule> result = await client.GetAsync(scheduleName ?? string.Empty); if (result.Code > 0 || result.Data == null) { return(RedirectToAction("Index", "Schedule")); } ViewBag.Schedule = result.Data; } using (ScheduleDetailServiceClient client = new ScheduleDetailServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { Where = string.Format(" Key.ScheduleName = '{0}'" , scheduleName) }; MethodReturnResult <IList <ScheduleDetail> > result = client.Get(ref cfg); if (result.Code == 0) { ViewBag.PagingConfig = cfg; ViewBag.List = result.Data; } }); } return(View(new ScheduleDetailQueryViewModel() { ScheduleName = scheduleName })); }