//[ModelStateValidationFilter] public IActionResult Post([FromBody] EmployeesViewModel employeesViewModel) { int id = 0; Employee c = _mapper.Map <EmployeesViewModel, Employee>(employeesViewModel); try { if (_IUnitOfWork.Employee.Find(x => x.EmplEmail == employeesViewModel.Email).FirstOrDefault() != null) { return(new ObjectResult($"Klient o podanym email : {employeesViewModel.Email}, istnieje juz w bazie klientów")); } _IUnitOfWork.Employee.Add(c); if (!_userOperation.Create(new ApplicationUser(), Models.Enums.UserRoles.WETERYNARZ, User).Result) { _IUnitOfWork.Employee.Remove(c); } _IUnitOfWork.Complete(); id = _IUnitOfWork.Employee.Find(x => x.EmplEmail == employeesViewModel.Email).First().Rowid; } catch (SqlException exc) { throw new Exception("Internal servier error"); } return(CreatedAtAction("Get", new { userID = id })); }