public ActionResult Create(StoreSpendStatisticsDto storeSpenddto) { var storespend = AutoMapper.Mapper.Map <StoreSpendStatistics>(storeSpenddto); storespend.StartYear = storeSpenddto.StartTime.Year; storespend.StartMonth = (byte)storeSpenddto.StartTime.Month; storespend.StartDay = (byte)storeSpenddto.StartTime.Day; storespend.EndYear = storeSpenddto.EndTime.Year; storespend.EndMonth = (byte)storeSpenddto.EndTime.Month; storespend.EndDay = (byte)storeSpenddto.EndTime.Day; var res = _storeSpendStatisticsContract.Insert(storespend); return(Json(res)); }
public ActionResult AddStoreSpend(StoreSpendStatisticsDto storeSpenddto) { try { var storespend = AutoMapper.Mapper.Map <StoreSpendStatistics>(storeSpenddto); storespend.StartYear = storeSpenddto.StartTime.Year; storespend.StartMonth = (byte)storeSpenddto.StartTime.Month; storespend.StartDay = (byte)storeSpenddto.StartTime.Day; storespend.EndYear = storeSpenddto.EndTime.Year; storespend.EndMonth = (byte)storeSpenddto.EndTime.Month; storespend.EndDay = (byte)storeSpenddto.EndTime.Day; var res = _storeSpendStatisticsContract.Insert(storespend); return(Json(res)); } catch (Exception) { return(Json(new OperationResult(OperationResultType.Error, "系统错误"))); } }