Exemple #1
0
 public ActionResult Edit(int Id)
 {
     Block block = _blockService.GetById(Id);
     BlockViewModel model = new BlockViewModel();
     model.Id = block.Id;
     model.Name = block.Name;
     model.Content = block.Content;
     model.status = (block.status == 1)? true : false;
     return View(model);
 }
Exemple #2
0
        public ActionResult Create(BlockViewModel model)
        {
            if(ModelState.IsValid)
            {
                Block block = new Block();
                block.Name = model.Name;
                block.Content = model.Content;
                block.status = model.status? 1:0;
                _blockService.Create(block);

                return RedirectToAction("Index");
            }
            return View(model);
        }
Exemple #3
0
 public ActionResult Edit(BlockViewModel model)
 {
     Block block = _blockService.GetById(model.Id);
     block.Name = model.Name;
     block.Content = model.Content;
     block.status = model.status ? 1 : 0;
     _blockService.Update(block);
     return RedirectToAction("Index");
 }