public static void Put(int Id, EventsUpdateRequest model) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.Events_Update" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", model.Id); paramCollection.AddWithValue("@UserId", model.UserId); paramCollection.AddWithValue("@Title", model.Title); paramCollection.AddWithValue("@Description", model.Description); paramCollection.AddWithValue("@Start", model.Start); paramCollection.AddWithValue("@End", model.End); paramCollection.AddWithValue("@EventType", model.EventType); paramCollection.AddWithValue("@IsPublic", model.IsPublic); // adding new parameter SqlParameter s = new SqlParameter("@TagsId", SqlDbType.Structured); if (model.Tags != null && model.Tags.Any()) { s.Value = new IntIdTable(model.Tags); } paramCollection.Add(s); }, returnParameters : delegate(SqlParameterCollection param) { } ); }
public HttpResponseMessage Update(EventsUpdateRequest model, int Id) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } SucessResponse response = new SucessResponse(); EventsService.Update(model); return(Request.CreateResponse(response)); }
public HttpResponseMessage Put(int Id, EventsUpdateRequest model) { if (model == null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Request payload was null")); } if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } //model.UserId = UserService.GetCurrentUserId(); EventsService.Put(Id, model); return(Request.CreateResponse(HttpStatusCode.OK, model)); }
public static void Put(int Id, EventsUpdateRequest model) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.Events_Update" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", model.Id); paramCollection.AddWithValue("@EventType", model.EventType); paramCollection.AddWithValue("@IsPublic", model.IsPublic); paramCollection.AddWithValue("@Title", model.Title); paramCollection.AddWithValue("@Description", model.Description); paramCollection.AddWithValue("@Start", model.Start); paramCollection.AddWithValue("@Duration", model.Duration); paramCollection.AddWithValue("@MediaId", model.MediaId); paramCollection.AddWithValue("@NumberAttendees", model.NumberAttendees); }, returnParameters : delegate(SqlParameterCollection param) { } ); }