public void Update(VenueUpdateRequest model, int userId) { _dataProvider.ExecuteNonQuery("dbo.Venues_Update", inputParamMapper: delegate (SqlParameterCollection parms) { parms.AddWithValue("@Id", model.Id); parms.AddWithValue("@Name", model.Name); parms.AddWithValue("@Description", model.Description); parms.AddWithValue("@LocationId", model.LocationId); parms.AddWithValue("@Url", model.Url); parms.AddWithValue("@AvatarUrl", model.AvatarUrl); parms.AddWithValue("@ModifiedBy", userId); }); }}
public void Update(VenueUpdateRequest request, int userId) { string procName = "[dbo].[Venues_Update]"; _data.ExecuteNonQuery(procName, inputParamMapper : delegate(SqlParameterCollection collection) { collection.AddWithValue("@Id", request.Id); collection.AddWithValue("@Name", request.Name); collection.AddWithValue("@Description", request.Description); collection.AddWithValue("@LocationId", request.LocationId); collection.AddWithValue("@Url", request.Url); collection.AddWithValue("@ModifiedBy", userId); }, returnParameters: null); }
public ActionResult <SuccessResponse> Update(VenueUpdateRequest model) { int code = 200; BaseResponse response = null; try { int userId = _authService.GetCurrentUserId(); _service.Update(model, userId); response = new SuccessResponse(); } catch (Exception exception) { code = 500; response = new ErrorResponse(exception.Message); base.Logger.LogError(exception.ToString()); } return(StatusCode(code, response)); }
public ActionResult <SuccessResponse> Update(int id, VenueUpdateRequest model) { try { int userId = _authenticationService.GetCurrentUserId(); if (id == model.Id) { SuccessResponse resp = new SuccessResponse(); _venuesService.Update(model, userId); return(Ok200(resp)); } else { return(NotFound404(new ErrorResponse("Bad Request: Body Id does not match Entity"))); } } catch (Exception ex) { Logger.LogError(ex.ToString()); return(StatusCode(500, new ErrorResponse(ex.Message))); } }