Esempio n. 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));
            }
        }
 //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);
     });
 }
        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);
            });
        }
Esempio n. 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));
            }
        }