public IActionResult Post(Employee emp)
        {
            var newemp = empService.Create(emp);

            if (newemp.Id == Guid.Empty)
            {
                return(StatusCode(500));
            }
            return(Ok(newemp));
        }
        public async Task <IActionResult> Create(CreateEmployeeDto item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ModelStateResult(ModelState)));
            }

            var createEmployeeResultDto = await _employeesService.Create(item, UserId);

            return(Ok(createEmployeeResultDto));
        }
Example #3
0
        public ActionResult Create(Employee employee, string picture)
        {
            string currentCompanyId = Request.Cookies["currentCompanyId"].Value;

            if (ModelState.IsValid)
            {
                var result = _employeesService.Create(employee, currentCompanyId, picture);
                if (result == true)
                {
                    return(RedirectToAction("Index"));
                }
            }
            return(View(employee));
        }
 public void Create(Employee employee)
 {
     employeesServiceDelegate.Create(employee);
 }
Example #5
0
        public async Task <IActionResult> Post(NewEmployeeDto newEmployeeDto)
        {
            var createdEmployee = await _employeesService.Create(newEmployeeDto);

            return(Ok(createdEmployee));
        }