Exemple #1
0
        public ActionResult <ServiceSubscriptionDto> CreateServiceSubscription([FromBody] ServiceSubscriptionDto dto)
        {
            ServiceSubscriptionDto createdDto;

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

            return(Ok(createdDto));
        }
Exemple #2
0
 public ActionResult <ServiceSubscriptionDto> UpdateServiceSubscription(int id, [FromBody] ServiceSubscriptionDto dto)
 {
     try
     {
         return(Ok(_serviceSubscriptionService.Update(id, dto)));
     }
     catch (KeyNotFoundException e)
     {
         return(NotFound($"{e.Message} ID: {id}"));
     }
 }