コード例 #1
0
        public ActionResult DeleteConsumption(int id)
        {
            string loggedUser = User.FindFirstValue("userId");

            if (loggedUser == null)
            {
                return(Unauthorized());
            }

            try
            {
                consumptionService.DeleteConsumption(id);
            }
            catch (SkrillaApiException e)
            {
                if ("not_found".Equals(e.Code))
                {
                    return(NotFound());
                }
                else
                {
                    return(BadRequest(e.Message));
                }
            }

            return(Accepted());
        }
コード例 #2
0
        public ActionResult DeleteConsumption(Int32 id)
        {
            _consumptionService.DeleteConsumption(UserId, id);

            return(Ok());
        }