Esempio n. 1
0
        public ActionResult Create(FormCollection formCollection)
        {
            if (Session["Email"] != null)
            {
                Institutional        institutional = new Institutional();
                InstitutionalContext context       = new InstitutionalContext();

                institutional.Name = formCollection["Name"];

                context.Institutionals.Add(institutional);
                context.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 2
0
        public ActionResult Edit(FormCollection formCollection, int?id)
        {
            if (Session["Email"] != null)
            {
                if (id != null)
                {
                    InstitutionalContext context       = new InstitutionalContext();
                    Institutional        institutional = context.Institutionals.Single(pro => pro.Id == id);

                    institutional.Name = formCollection["Name"];

                    context.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Index", "Institutional"));
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 3
0
        public ActionResult Delete(int?id, FormCollection formCollection)
        {
            if (Session["Email"] != null)
            {
                if (id != null)
                {
                    InstitutionalContext context       = new InstitutionalContext();
                    Institutional        institutional = context.Institutionals.Single(pro => pro.Id == id);

                    context.Institutionals.Remove(institutional);

                    context.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Index", "Institutional"));
                }
            }
            return(RedirectToAction("Index", "Home"));
        }