Example #1
0
        public ActionResult <CaseResponse> Post([FromBody] Case newItem)
        {
            var response = new CaseResponse();

            if (newItem is null)
            {
                return(BadRequest());
            }

            response.Case = _caseService.AddCase(newItem);

            response.Achievements = AwardAchievements((Guid)newItem.UserId);

            var lvl = _levelingService.AddExperience(newItem.UserId, Activity.CreatedCase);

            if (lvl > 0)
            {
                response.LevelupResponse = new LevelupResponse
                {
                    NewLevel = lvl
                };
            }

            return(Ok(response));
        }
Example #2
0
        public HttpResponseMessage AddCase(HttpRequestMessage request, [FromBody] Case obsCase)
        {
            return(Execute(request, () =>
            {
                bool completed = _caseService.AddCase(obsCase);

                return request.CreateResponse(completed);
            }));
        }