Example #1
0
        /// <summary>
        /// 保存信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ApiResult <bool> Save(DutyRecord model, UserInfo userInfo)
        {
            ApiResult <bool> result = new ApiResult <bool>();

            try
            {
                using (CommonDbContext db = new CommonDbContext())
                {
                    if (string.IsNullOrEmpty(model.DutyRecordId))
                    {
                        db.Set <DutyRecord>().Insert(model);
                    }
                    else
                    {
                        db.Set <DutyRecord>().Update(model);
                    }
                    result.Result = db.SaveChanges() > 0;
                    result.Code   = ResultCode.Success;
                }
            }
            catch (Exception e)
            {
                result.Code    = ResultCode.SystemError;
                result.Message = e.ToString();
            }
            return(result);
        }
Example #2
0
 public ApiResult<bool> Put([FromBody]DutyRecord DutyRecord)
 {
     return DutyRecordService.Save(DutyRecord, CurrentUserInfo);
 }