コード例 #1
0
        public ActionResult AddProducer()
        {
            var model = new AddProducerInputModel
            {
                Country = this.GetCountries()
            };

            return(View(model));
        }
コード例 #2
0
        public ActionResult AddProducer()
        {
            var model = new AddProducerInputModel
            {
                Country = this.GetCountries()
            };

            return View(model);
        }
コード例 #3
0
        public ActionResult AddProducer(AddProducerInputModel model)
        {
            if (ModelState.IsValid)
            {
                var newProducer = new Producer
                {
                    Name      = model.Name,
                    Address   = model.Address,
                    DateAdded = DateTime.UtcNow,
                    Email     = model.Email,
                    Telephone = model.Telephone,
                    Website   = model.Website,
                    CountryId = int.Parse(model.Country.CountryId)
                };

                this.producers.Add(newProducer);
            }

            return(Redirect("/"));
        }
コード例 #4
0
        public ActionResult AddProducer(AddProducerInputModel model)
        {
            if (ModelState.IsValid)
            {
                var newProducer = new Producer
                {
                    Name = model.Name,
                    Address = model.Address,
                    DateAdded = DateTime.UtcNow,
                    Email = model.Email,
                    Telephone = model.Telephone,
                    Website = model.Website,
                    CountryId = int.Parse(model.Country.CountryId)
                };

                this.producers.Add(newProducer);
            }

            return Redirect("/");
        }