Ejemplo n.º 1
0
 public HttpResponseMessage EditAccount(HttpRequestMessage request, RequestEditAccountDTO obj)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response;
         response = request.CreateResponse(HttpStatusCode.OK, _service.Edit(obj));
         return response;
     }));
 }
Ejemplo n.º 2
0
        public ResultDTO Edit(RequestEditAccountDTO obj)
        {
            ResultDTO accInfo = new ResultDTO();

            try
            {
                accInfo = _repository.EditAccount(obj);
            }
            catch (Exception ex)
            {
                Utilities.AppLog.WriteLog("EditAccount", ActionType.Update, ex.Message.ToString(), obj.SessionKey);
                accInfo.StatusCode = Utilities.Common.ConvertErrorCodeToInt(RetCode.ECS9999);
                accInfo.StatusMsg  = ex.Message.ToString();
            }

            return(accInfo);
        }
        public static ResultDTO EditAccount(this IEntityBaseRepository <Account> repository, RequestEditAccountDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

            var errorCode = new SqlParameter("ErrorCode", System.Data.SqlDbType.Int)
            {
                Direction = System.Data.ParameterDirection.Output
            };


            dbContext.Database.ExecuteSqlCommand("EXEC [dbo].[sp_EditAccount] @FullName,@UserName, @SessionKey, @errorCode out",
                                                 new SqlParameter("FullName", DB.SafeSQL(obj.FullName)),
                                                 new SqlParameter("UserName", DB.SafeSQL(obj.UserName)),
                                                 new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                 errorCode);
            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();

            return(result);
        }