예제 #1
0
        public ActionResult Create(FormCollection formCollection)
        {
            if (Session["Email"] != null)
            {
                Rotation        rotations = new Rotation();
                RotationContext context   = new RotationContext();

                rotations.Rotations  = formCollection["Rotations"];
                rotations.Supervisor = formCollection["Supervisor"];

                context.Rotations.Add(rotations);
                context.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index", "Home"));
        }
예제 #2
0
        public ActionResult Delete(int?id, FormCollection formCollection)
        {
            if (Session["Email"] != null)
            {
                if (id != null)
                {
                    RotationContext context   = new RotationContext();
                    Rotation        rotations = context.Rotations.Single(pro => pro.Id == id);

                    context.Rotations.Remove(rotations);

                    context.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Index", "Rotation"));
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
예제 #3
0
        public ActionResult Edit(FormCollection formCollection, int?id)
        {
            if (Session["Email"] != null)
            {
                if (id != null)
                {
                    RotationContext context  = new RotationContext();
                    Rotation        rotation = context.Rotations.Single(pro => pro.Id == id);

                    rotation.Rotations  = formCollection["Rotations"];
                    rotation.Supervisor = formCollection["Supervisor"];

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