示例#1
0
        public IActionResult AddToFavourite([FromBody] UserFavourites favourite)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(StatusCode(StatusCodes.Status400BadRequest, Constants.InputInvalid));
                }

                return(Created("", _weatherService.AddToFavourite(favourite)));
            }
            catch (UserAlreadyExistsException ex)
            {
                return(Conflict(ex.Message));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }