Esempio n. 1
0
        public ApiResponse <bool> UpdateAcceptProxy(int id, UpdateAcceptProxyModel model)
        {
            if (id < 0 || model == null)
            {
                throw new ApiBadRequestException("Bad request");
            }

            ApiResponse <bool> response = new ApiResponse <bool>()
            {
                Result = AcceptProxyService.UpdateAcceptProxy(model, id)
            };

            return(response);
        }
        /// <summary>
        /// 更新签收单
        /// </summary>
        /// <returns>是否更新成功</returns>
        public bool UpdateAcceptProxy(UpdateAcceptProxyModel acceptProxy, int acceptProxyId)
        {
            using (var dbContext = new MissionskyOAEntities())
            {
                //查询申请信息是否存在
                var AcceptProxyEntity = dbContext.AcceptProxies.Where(it => it.Id == acceptProxyId).FirstOrDefault();
                if (AcceptProxyEntity == null)
                {
                    throw new Exception("This express doesn't exist.");
                }

                AcceptProxyEntity.Description    = acceptProxy.Description;
                AcceptProxyEntity.LastModifyTime = DateTime.Now;
                AcceptProxyEntity.AcceptUserId   = acceptProxy.AcceptUserId;
                if (AcceptProxyEntity.Status == (int)ExpressStatus.Proxy)
                {
                    AcceptProxyEntity.Status = (int)acceptProxy.Status;
                }
                // 保存更改
                dbContext.SaveChanges();
                return(true);
            }
        }