public async Task <IActionResult> PostConsumptionType([FromBody] T_ConsumptionType ConsumptionType) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } bool flag = false; ConsumptionType.ConsumptionTypeCreateDate = DateTime.Now; ConsumptionType.ConsumptionTypeGuid = Guid.NewGuid(); flag = await consumptionTypeService.Add(ConsumptionType); return(Ok(new { success = flag, })); } catch (Exception ex) { return(Ok(new { success = false, message = ex.Message })); } }
public async Task <IActionResult> InitConsumptionType() { try { T_ConsumptionType t_ConsumptionType = new T_ConsumptionType(); t_ConsumptionType.ConsumptionTypeName = "早餐"; t_ConsumptionType.ConsumptionTypeCreateDate = DateTime.Now; t_ConsumptionType.ConsumptionTypeGuid = Guid.NewGuid(); t_ConsumptionType.ConsumptionTypeClass = "labal"; bool flag = await consumptionTypeService.Add(t_ConsumptionType); return(Ok(new { syccess = flag, message = "加入" })); } catch (Exception ex) { return(Ok(new { syccess = false, message = ex.Message })); } }