public ActionResult Create(PageContent pagecontent)
        {
            if (ModelState.IsValid)
            {
                db.PagesContent.Add(pagecontent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pagecontent));
        }
Пример #2
0
        public ActionResult Create(Certificate certificate)
        {
            if (ModelState.IsValid)
            {
                db.Certificates.Add(certificate);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(certificate));
        }
Пример #3
0
        public ActionResult Create(Client client)
        {
            if (ModelState.IsValid)
            {
                client.HasLogo = false;
                var file = Request.Files[0];

                if (file != null && file.ContentLength > 0)
                {
                    var path = Path.Combine(Server.MapPath("~/_DynamicContent/"), client.ClientName + ".gif");
                    file.SaveAs(path);
                    client.HasLogo = true;
                }

                db.Clients.Add(client);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(client));
        }