示例#1
0
 public ActionResult <ServiceLeaderDto> UpdateServiceLeader(int id, [FromBody] ServiceLeaderDto dto)
 {
     try
     {
         return(Ok(_serviceLeaderService.Update(id, dto)));
     }
     catch (KeyNotFoundException e)
     {
         return(NotFound($"{e.Message} ID: {id}"));
     }
 }
示例#2
0
        public ActionResult <ServiceLeaderDto> CreateServiceLeader([FromBody] ServiceLeaderDto dto)
        {
            ServiceLeaderDto createdDto;

            try
            {
                createdDto = _serviceLeaderService.Create(dto);
            }
            catch (KeyNotFoundException e)
            {
                return(NotFound(e.Message));
            }

            return(Ok(createdDto));
        }