コード例 #1
0
        public void UpdateAddress(AddressUpdateRequest model, string userId)
        {
            int uid = 0;

            DataProvider.ExecuteNonQuery(GetConnection, "dbo.Addresses_UpdateById"
               , inputParamMapper: delegate(SqlParameterCollection paramCollection)
               {
                   paramCollection.AddWithValue("@Line1", model.Line1);
                   paramCollection.AddWithValue("@Line2", model.Line2);
                   paramCollection.AddWithValue("@City", model.City);
                   paramCollection.AddWithValue("@State", model.State);
                   paramCollection.AddWithValue("@Zip", model.Zip);
                   paramCollection.AddWithValue("@Country", model.Country);
                   paramCollection.AddWithValue("@UserId", userId);
                   paramCollection.AddWithValue("@Id", model.Id);

               }
               , returnParameters: delegate(SqlParameterCollection param)
               {
                   int.TryParse(param["@Id"].Value.ToString(), out uid);
               }
               );
        }
コード例 #2
0
        public HttpResponseMessage UpdateAddressInfo(AddressUpdateRequest model)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            string userId = _userService.GetCurrentUserId();
            SuccessResponse response = new SuccessResponse();
            _addressesService.UpdateAddress(model, userId);
            return Request.CreateResponse(response);
        }