public async Task <IActionResult> Create(ItemsDataModel model) { if (!ModelState.IsValid) { return(Operation(false, "数据验证失败;" + GetErrorFromModelStateStr(), model.GoBackUrl)); } ItemsData module = model.MapTo <ItemsData>(); module.Id = module.CreateId(); module.CreatorTime = DateTime.Now; module.CreatorUserId = CurrentUser().Id; var r = await ItemsDataApp.CreateAsync(module); return(Json(r)); }
public async Task <IActionResult> Create(ItemsDataModel model) { if (!ModelState.IsValid) { return(Operation(false, "数据验证失败;" + GetErrorFromModelStateStr(), model.GoBackUrl)); } ItemsData module = MapperHelper.Map <ItemsDataModel, ItemsData>(model); module.Id = module.CreateId(); module.CreatorTime = DateTime.Now; module.CreatorUserId = CurrentUser.Id; var r = await IItemsDataApp.CreateAsync(module); return(Operation(r.IsSuc, r.IsSuc ? "数据添加成功" : r.Msg, model.GoBackUrl)); }