public IActionResult Post([FromBody] Engineer engineer)
 {
     _engineerRepository.Add(engineer);
     return(new ObjectResult(engineer.Id)
     {
         StatusCode = StatusCodes.Status201Created
     });
 }
        public IActionResult Post([FromBody] string name)
        {
            var engineer = new EngineerModel {
                Name = name
            };

            _engineerRepository.Add(engineer);
            return(new ObjectResult(engineer.Id)
            {
                StatusCode = StatusCodes.Status201Created
            });
        }
        public async Task <IActionResult> NewEngineer([FromBody] SaveEngineerResource model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var engineer = new Engineer(model.Name, model.ContactNumber, model.Address, UserId);

            _engineerRepository.Add(engineer);

            await _unitOfWork.CompleteAsync();

            return(Ok(_mapper.Map <Engineer, EngineerResource>(engineer)));
        }
Exemple #4
0
 public void Add(Engineer e)
 {
     repo.Add(e);
 }
Exemple #5
0
 public Engineer Add(Engineer item)
 {
     return(_repo.Add(item));
 }