コード例 #1
0
        public IHttpActionResult Put(EventTypeUpdateRequest model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                _eventTypeService.Put(model);

                return(Ok(new SuccessResponse()));
            }
            catch (Exception ex)
            {
                _errorLogService.Post(new Models.Requests.Logs.ErrorLogAddRequest
                {
                    ErrorSourceTypeId = 1,
                    Message           = ex.Message,
                    StackTrace        = ex.StackTrace,
                    Title             = "Error in " + GetType().Name + " " + System.Reflection.MethodBase.GetCurrentMethod().Name
                });
                return(BadRequest(ex.Message));
            }
        }
コード例 #2
0
 //Update Event Type
 public void Put(EventTypeUpdateRequest model)
 {
     DataProvider.ExecuteNonQuery("dbo.Events_EventType_Update",
                                  inputParamMapper : delegate(SqlParameterCollection paramCollection)
     {
         paramCollection.AddWithValue("@Id", model.Id);
         paramCollection.AddWithValue("@TypeName", model.TypeName);
         paramCollection.AddWithValue("@TypeDescription", model.TypeDescription);
     });
 }
コード例 #3
0
        public void Update(EventTypeUpdateRequest model)
        {
            DataProvider.ExecuteNonQuery("dbo.EventType_Update",

                                         inputParamMapper: (SqlParameterCollection inputs) =>
            {
                inputs.AddWithValue("@Id", model.Id);
                inputs.AddWithValue("@TypeName", model.TypeName);
                inputs.AddWithValue("@TypeDescription", model.TypeDescription);
            });
        }
コード例 #4
0
        public IHttpActionResult Put(int id, EventTypeUpdateRequest model)
        {
            try
            {
                model.Id = id;
                _eventTypeService.Update(model);
                return(Ok(new SuccessResponse()));
            }
            catch (Exception ex)
            {
                int currentUser = _userService.GetCurrentUserId();
                _appLogService.Insert(new AppLogAddRequest
                {
                    AppLogTypeId = 1,
                    Message      = ex.Message,
                    StackTrace   = ex.StackTrace,
                    Title        = "Error in " + GetType().Name + " " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                    UserBaseId   = currentUser
                });

                return(BadRequest(ex.Message));
            }
        }