Example #1
0
        public async Task <MSSResult> Update(ActionInfo action)
        {
            MSSResult mRet = new MSSResult();

            try
            {
                action.UpdatedTime = DateTime.Now;
                action.UpdatedBy   = userID;
                mRet.data          = await _ActionRepo.Update(action);
                await SaveRedis();

                mRet.code = (int)ErrType.OK;
                return(mRet);
            }
            catch (Exception ex)
            {
                mRet.code = (int)ErrType.SystemErr;
                mRet.msg  = ex.Message;
                return(mRet);
            }
        }
Example #2
0
        public ActionResult Update(ActionDTO action)
        {
            MethodBase method = MethodBase.GetCurrentMethod();

            try
            {
                if (action.Id > 0)
                {
                    Action upAction = Mapper.Map <Action>(action);
                    ActionRepo.Update(upAction);
                    CreateLog(Enums.Success, GetMethodCode(method), LogLevel.Information);
                    return(Ok(upAction.Id));
                }
                else
                {
                    CreateLog(Enums.BadRequest, GetMethodCode(method), LogLevel.Information);
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                return(HandleError(ex.Message, GetMethodCode(method)));
            }
        }