public int UpdateTopic(TopicUpdateRequest model) { int id = 0; DataProvider.ExecuteNonQuery(GetConnection, "dbo.ForumTopics_UpdateById" , inputParamMapper: delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", model.Id); paramCollection.AddWithValue("@Name", model.Name); } , returnParameters: delegate(SqlParameterCollection param) { int.TryParse(param["@Id"].Value.ToString(), out id); } ); return id; }
public HttpResponseMessage UpdateTopic(TopicUpdateRequest model) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } //string userId = _userService.GetCurrentUserId(); ////Check if admin code //bool userIsAdmin = false; //IdentityUser currentUser = _userService.GetCurrentUser(); //if (currentUser != null) //{ // List<IdentityUserRole> roles = currentUser.Roles.ToList(); // foreach (var role in roles) // { // if (role.RoleId == _superAdmin || role.RoleId == _admin) // { // userIsAdmin = true; // break; // } // } //} //_userService.GetCurrentUser(); SuccessResponse response = new SuccessResponse(); _forumService.UpdateTopic(model); return Request.CreateResponse(HttpStatusCode.OK, response); }