Exemple #1
0
        public ActionResult Detail(int id, EventTaskTemplate model, string returnUrl, FormCollection m)
        {
            EventTaskTemplate p;
            Entities          cx = new Entities();

            model.Data = TaskTemplate.ArrSerialize(TaskTemplate.ArrDeserialize(model.Data));
            if (model.Id == 0)
            {
                p = model;
                cx.EventTaskTemplate.Add(p);
                cx.SaveChanges();
            }
            else
            {
                p      = cx.EventTaskTemplate.Single(e => e.Id == id);
                p.Name = model.Name;
                p.Data = model.Data;
                cx.SaveChanges();
            }

            // redirect
            if (returnUrl != null && returnUrl.Length > 0)
            {
                return(Redirect(returnUrl));
            }
            else
            {
                return(RedirectToAction("TaskTemplate", "List"));
            }
        }
Exemple #2
0
        public ActionResult Detail(int id, string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            EventTaskTemplate p;

            if (id == 0)
            {
                p = new EventTaskTemplate();
            }
            else
            {
                p = new Entities().EventTaskTemplate.Where(e => e.Id == id).Single();
            }
            return(View(p));
        }