public static void PutAdmin(Guid userId, UserAdminUpdateRequest model) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.UserProfile_Update" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@profileName", model.profileName); paramCollection.AddWithValue("@profileLastName", model.profileLastName); paramCollection.AddWithValue("@profilePhone", model.profilePhone); paramCollection.AddWithValue("@profileMobile", model.profileMobile); paramCollection.AddWithValue("@profileWebsite", model.profileWebsite); paramCollection.AddWithValue("@profileAddress", model.profileAddress); paramCollection.AddWithValue("@profileCompany", model.profileCompany); paramCollection.AddWithValue("@userId", userId); paramCollection.AddWithValue("@Tagline", model.Tagline); SqlParameter p = new SqlParameter("@TagsId", SqlDbType.Structured); if (model.UserTags != null && model.UserTags.Any()) { p.Value = new IntIdTable(model.UserTags); } paramCollection.Add(p); }, returnParameters : delegate(SqlParameterCollection param) { } ); }
public static void PutAdmin(UserAdminUpdateRequest model) { //send to the aspnet table //AspNetUserUpdateRequest a = new AspNetUserUpdateRequest(); //a.UserId = model.UserId; //a.PhoneNumber = model.PhoneNumber; //a.PasswordHash = model.PasswordHash; //a.TwoFactorEnabled = model.TwoFactorEnabled; //a.LockoutEndDateUtc = model.LockoutEndDateUtc; //a.LockoutEnabled = model.LockoutEnabled; //a.AccessFailedCount = model.AccessFailedCount; //a.UserName = model.UserName; //PutToAspNetTable(a); //send to the myprofile table UserAdminUpdateRequest p = new UserAdminUpdateRequest(); p.profileName = model.profileName; p.profileEmail = model.profileEmail; p.profilePhone = model.profilePhone; p.profileMobile = model.profileMobile; p.profileWebsite = model.profileWebsite; p.profileAddress = model.profileAddress; p.profileCompany = model.profileCompany; p.UserId = model.UserId; p.Tagline = model.Tagline; PutToMyProfileTable(p); }
public static void PutToMyProfileTable(UserAdminUpdateRequest model) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.UserProfile_UpdateByUserId" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@profileName", model.profileName); paramCollection.AddWithValue("@profileEmail", model.profileEmail); paramCollection.AddWithValue("@profilePhone", model.profilePhone); paramCollection.AddWithValue("@profileMobile", model.profileMobile); paramCollection.AddWithValue("@profileWebsite", model.profileWebsite); paramCollection.AddWithValue("@profileAddress", model.profileAddress); paramCollection.AddWithValue("@profileCompany", model.profileCompany); paramCollection.AddWithValue("@Tagline", model.Tagline); paramCollection.AddWithValue("@UserId", model.UserId); }, returnParameters : delegate(SqlParameterCollection param) { } ); }
[Route("admin/{userId:Guid}"), HttpPut] //Update profile public HttpResponseMessage AdminUpdate(Guid userId, UserAdminUpdateRequest model) { if (model == null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Request payload was null")); } model.UserId = userId; if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } UserProfileServices.PutAdmin(userId, model); ItemResponse <bool> response = new ItemResponse <bool>(); response.Item = true; return(Request.CreateResponse(HttpStatusCode.OK, response)); }