public IActionResult CategoryAdd(CategoryDto viewModel) { viewModel.wxapp_id = GetAdminSession().wxapp_id; viewModel.create_time = DateTime.Now; viewModel.update_time = DateTime.Now; try { var model = viewModel.Mapper <yoshop_category>(); CategoryService.AddEntity(model); } catch (Exception e) { LogManager.Error(GetType(), e); return(No(e.Message)); } return(YesRedirect("添加成功!", "/goods.category/index")); }
public async Task <IActionResult> Add(CategoryDto request) { request.WxappId = GetSellerSession().WxappId; request.CreateTime = DateTime.Now; request.UpdateTime = DateTime.Now; try { var model = request.Mapper <Category>(); await _fsql.Insert <Category>().AppendData(model).ExecuteAffrowsAsync(); } catch (Exception e) { LogManager.Error(GetType(), e); return(No(e.Message)); } return(YesRedirect("添加成功!", "/goods.category/index")); }