Ejemplo n.º 1
0
        public async Task <IActionResult> AddDept([FromBody] SaveDepartmentResource DepartmentResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var DeptToCreate = _mapper.Map <SaveDepartmentResource, Departments>(DepartmentResource);

            _repo.CreateDept(DeptToCreate);
            await _unitofwork.CompleteAsync();

            return(StatusCode(201));
        }