コード例 #1
0
 public void Update(MemberProfileUpdateRequest model)
 {
     try
     {
         _baseService.DataProvider.ExecuteNonQuery(_baseService.GetConnection, "dbo.MemberProfile_UpdateByID", inputParamMapper : delegate(SqlParameterCollection paramCollection)
         {
             paramCollection.AddWithValue("@Id", model.Id);
             paramCollection.AddWithValue("@AspNetUserID", model.AspNetUserID);
             paramCollection.AddWithValue("@FirstName", model.FirstName);
             paramCollection.AddWithValue("@MiddleName", model.MiddleName);
             paramCollection.AddWithValue("@LastName", model.LastName);
             paramCollection.AddWithValue("@PhoneNumber", model.PhoneNumber);
             paramCollection.AddWithValue("@Address1", model.Address1);
             paramCollection.AddWithValue("@Address2", model.Address2);
             paramCollection.AddWithValue("@City", model.City);
             paramCollection.AddWithValue("@StateProvinceId", model.StateProvinceId);
             paramCollection.AddWithValue("@Zip", model.Zip);
             paramCollection.AddWithValue("@DateOfBirth", model.DateOfBirth);
             paramCollection.AddWithValue("@Email", model.Email);
             paramCollection.AddWithValue("@Gender", model.Gender);
             paramCollection.AddWithValue("@IsActive", model.IsActive);
             paramCollection.AddWithValue("@IsViewable", model.IsViewable);
             paramCollection.AddWithValue("@IsGymOwner", model.IsGymOwner);
             paramCollection.AddWithValue("@CrossfitLevelId", model.CrossFitLevelID);
             paramCollection.AddWithValue("@IsPublic", model.IsPublic);
             paramCollection.AddWithValue("@AlertUsingTextMessage", model.AlertUsingTextMessage);
             paramCollection.AddWithValue("@AlertUsingEmail", model.AlertUsingEmail);
         });
     }
     catch (Exception ex)
     {
         _baseService.LogError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex, "MemberProfileService");
         throw;
     }
 }
コード例 #2
0
        public HttpResponseMessage Update(MemberProfileUpdateRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, string.Join(", ", ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage))));
            }
            SuccessResponse response = new SuccessResponse();

            try
            {
                _memberProfileService.Update(model);
                return(Request.CreateResponse(HttpStatusCode.OK, response));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }