Exemple #1
0
        public ActionResult <ItemResponse <int> > Create(ListingAddRequest model)
        {
            ObjectResult result = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                int id     = _service.Add(model, userId);

                ItemResponse <int> response = new ItemResponse <int>()
                {
                    Item = id
                };
                result = Created201(response);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                ErrorResponse response = new ErrorResponse(ex.Message);
                result = StatusCode(500, response);
            }

            return(result);
        }