Пример #1
0
 public ActionResult Delete(ASF.Entities.Category model)
 {
     if (ModelState.IsValid)
     {
         var cp = new ASF.UI.Process.CategoryProcess();
         cp.Delete(model.Id);
     }
     return(RedirectToAction("Index"));
 }
Пример #2
0
 public ActionResult Create(ASF.Entities.Category model)
 {
     if (ModelState.IsValid)
     {
         var cp = new ASF.UI.Process.CategoryProcess();
         model.CreatedOn = DateTime.Now;
         model.ChangedOn = DateTime.Now;
         cp.Create(model);
     }
     return(RedirectToAction("Index"));
 }
Пример #3
0
        //
        // GET: /Category/Category/Delete/5
        public ActionResult Delete(int id)
        {
            try
            {
                var category = new ASF.Entities.Category();
                category.Id = id;

                categoryProcess.Remove(category);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }



            return(RedirectToAction("Index"));
        }
Пример #4
0
        public ActionResult Create(FormCollection collection)
        {
            // TODO: Add insert logic here
            var name = collection["Name"];

            var newCateogry = new ASF.Entities.Category();

            newCateogry.Name      = name;
            newCateogry.ChangedOn = DateTime.Now;
            newCateogry.CreatedOn = DateTime.Now;
            try
            {
                newCateogry = categoryProcess.Add(newCateogry);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
                //return View();
            }
        }