Example #1
0
 public IHttpActionResult Create([FromBody] CreateEmployeementTypeDto employeementType)
 {
     if (employeementType == null)
     {
         return(BadRequest());
     }
     if (!ModelState.IsValid)
     {
         string errorMessage = new ModelStateError(_logger).OutputMessage(ModelState);
         return(BadRequest(errorMessage));
     }
     try
     {
         _employeementTypeService.Create(employeementType);
     }
     catch (LogicalException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch
     {
         return(BadRequest(AppSettings.INTERNAL_SERVER_ERROR_MESSAGE));
     }
     return(Ok());
 }
Example #2
0
        public void Create(CreateEmployeementTypeDto dto)
        {
            var employeementType = new EmployeementType
            {
                Title = dto.Title
            };

            _employeementTypeRepository.Insert(employeementType);
        }