Esempio n. 1
0
        public IActionResult CreateService([FromBody] M.ServiceCreateUpdateModes serv)
        {
            if (!ModelState.IsValid)
            {
                return(new ObjectResult(ModelState));
            }
            var toDb = _mapper.Map <D.Service>(serv);
            var c    = _repository.service.Create(toDb);

            return(new ObjectResult(c));
        }
Esempio n. 2
0
        public IActionResult ModifyServices([FromBody] M.ServiceCreateUpdateModes serv)
        {
            if (!ModelState.IsValid)
            {
                return(new ObjectResult(ModelState));
            }
            if (_repository.service.FindById(s => s.serviceId == serv.serviceId) == null)
            {
                return(NotFound("Not Service in db"));
            }

            var toDb = _mapper.Map <D.Service>(serv);
            var c    = _repository.service.Update(toDb);

            return(new ObjectResult(c));
        }