/// <summary>
        /// 批量新增饮水量
        /// </summary>
        /// <param name="input"></param>
        public void BatchAdd(AddWaterInput input)
        {
            List <Water> waterList   = new List <Water>();
            DateTime     currentTime = DateTime.Now;

            foreach (var item in input.Drink)
            {
                waterList.Add(new Water
                {
                    Id          = _idGenerator.CreateId(),
                    PatientId   = input.PatientId,
                    DrinkVolume = item.DrinkVolume,
                    DrinkTime   = item.DrinkTime,
                    AddTime     = currentTime
                });
            }
            _context.Water.AddRange(waterList);
        }
 /// <summary>
 /// 新增饮水量
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public OutputBase Add(AddWaterInput input)
 {
     _repository.BatchAdd(input);
     return(_unitWork.Commit() ? OutputBase.Success("保存成功") : OutputBase.Fail("保存失败"));
 }
Exemplo n.º 3
0
 public OutputBase Add([FromBody] AddWaterInput input)
 {
     return(_service.Add(input));
 }