コード例 #1
0
        public IHttpActionResult CreateDoor([FromBody] string name)
        {
            FakeDatabase fakeDatabase = new FakeDatabase();

            fakeDatabase.Add(name);

            return(Ok());
        }
コード例 #2
0
        public ActionResult AddContact(Contact c)
        {
            var database = new FakeDatabase();

            database.Add(c);

            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult AddMovie(MovieProperties newMovie)
 {
     if (ModelState.IsValid)
     {
         var database = new FakeDatabase();
         database.Add(newMovie);
         return(RedirectToAction("Index"));
     }
     return(View("Add", newMovie));
 }
コード例 #4
0
        public ActionResult Create(DealerViewModel dealer)
        {
            if (!ModelState.IsValid)
            {
                return(View(dealer));
            }

            try
            {
                FakeDatabase.Add(dealer);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View("Edit", dealer));
            }
        }