Ejemplo n.º 1
0
 public IHttpActionResult Create([FromBody] CreateGroupCategoryDto groupCategory)
 {
     if (groupCategory == null)
     {
         return(BadRequest());
     }
     if (!ModelState.IsValid)
     {
         string errorMessage = new ModelStateError(_logger).OutputMessage(ModelState);
         return(BadRequest(errorMessage));
     }
     try
     {
         _groupCategoryService.Create(groupCategory);
     }
     catch (LogicalException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch
     {
         return(BadRequest(AppSettings.INTERNAL_SERVER_ERROR_MESSAGE));
     }
     return(Ok());
 }
Ejemplo n.º 2
0
        public void Create(CreateGroupCategoryDto dto)
        {
            var groupCategory = new GroupCategory
            {
                Title = dto.Title
            };

            _groupCategoryRepository.Insert(groupCategory);
        }