Exemplo n.º 1
0
        public IHttpActionResult PostCharacter(Character character)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            chars.AddCharacter(character);

            return(CreatedAtRoute("DefaultApi", new { id = character.Id }, character));
        }
Exemplo n.º 2
0
        public ActionResult Create(Character character)
        {
            try
            {
                // TODO: Add insert logic here
                var repo = new CharacterRepo();

                repo.AddCharacter(character);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(View());
            }
        }
Exemplo n.º 3
0
        public ActionResult Edit(Character character)
        {
            var repo = new CharacterRepo();

            if (characterUserId == 1)
            {
                if (HomeController._currentUser != null)
                {
                    repo.AddCharacter(character);
                }
            }
            else
            {
                repo.UpdateCharacter(character);
            }
            characterUserId = null;

            return(RedirectToAction("Index"));
        }