public IHttpActionResult PostGameCrewSuggestion(SuggestionUsersDTO suggestionUsers)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     facade.GetSuggestionUsersRepository().Add(converter.Reverse(suggestionUsers));
     return CreatedAtRoute("DefaultApi", new { id = suggestionUsers.Id }, suggestionUsers);
 }
        public IHttpActionResult PutSuggestionUsers(int id, SuggestionUsersDTO suggestionUsersDTO)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != suggestionUsersDTO.Id)
            {
                return BadRequest();
            }
            facade.GetSuggestionUsersRepository().Update(converter.Reverse(suggestionUsersDTO));

            return StatusCode(HttpStatusCode.NoContent);
        }
Exemplo n.º 3
0
        public ActionResult Done()
        {
            CrewGameSuggestionDTO cgs = (CrewGameSuggestionDTO)Session["CrewGameSuggestion"];
            cgs.PlatformGame = facade.GetPlatformGameGateway().Get(cgs.PlatformGameId);
            cgs.Crew = facade.GetCrewGateway().Get(cgs.CrewId);
            facade.GetCrewGameSuggestionGateway().Create(cgs);

            CrewGameSuggestionDTO cgsWithId = facade.GetCrewGameSuggestionGateway().GetAll().Last();
            SuggestionUsersDTO su = new SuggestionUsersDTO() { CrewGameSuggestionId = cgsWithId.Id,
                                                        CrewGameSuggestion = cgsWithId, UserId =
                                                        Auth.user.Id, User = Auth.user, HasConfirmed = true};
            facade.GetSuggestionUsersGateway().Create(su);

            return View(cgsWithId);
        }