Example #1
0
 public static void Delete(Cinema item)
 {
     try
     {
         var items = GetAll();
         var itemToDelete = items.Where(p => p.Id == item.Id).FirstOrDefault();
         items.Remove(itemToDelete);
         Add(items);
     }
     catch { }
 }
Example #2
0
 public ActionResult Manage(Cinema item, string[] amenities)
 {
     if (item.Id != Guid.Empty)
     {
         Helper.Cinemas.Update(item);
     }
     else
     {
         item.Id = Guid.NewGuid();
         Helper.Cinemas.Add(item);
     }
     return RedirectToAction("Index");
 }
Example #3
0
        public static void Add(Cinema item)
        {
            try
            {
                var items = GetAll();

                if (items.Any(p => p.Id == item.Id || (p.Name == item.Name && p.Address == item.Address)))
                    return;

                items.Add(item);
                Add(items);
            }
            catch { }
        }
Example #4
0
        public ActionResult Manage(Guid? id)
        {
            var item = new Cinema();
            ViewBag.Mode = "Add New";
            ViewBag.IsEditMode = false;

            if (id.HasValue && id.Value != Guid.Empty)
            {
                item = Helper.Cinemas.Get(id.Value);
                ViewBag.Mode = "Edit";
                ViewBag.IsEditMode = true;
            }

            return View(item);
        }
Example #5
0
        public static void Update(Cinema item)
        {
            try
            {
                var items = GetAll();

                var oldItem = items.Where(p => p.Id == item.Id).FirstOrDefault();

                items.Remove(oldItem);
                items.Add(item);

                Add(items);
            }
            catch { }
        }