Пример #1
0
 public void Update(Block block)
 {
     Block _block = dbCon.Blocks.SingleOrDefault(x => x.Id == block.Id);
     if (_block != null)
     {
         _block.status = block.status;
         _block.Name = block.Name;
         _block.Content = block.Content;
         dbCon.SaveChanges();
     }
 }
Пример #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);
        }
Пример #3
0
 public void Update(Block block)
 {
     _blockRepository.Update(block);
 }
Пример #4
0
 public void Delete(Block block)
 {
     _blockRepository.Delete(block);
 }
Пример #5
0
 public void Create(Block block)
 {
     _blockRepository.Create(block);
 }
Пример #6
0
 public void Delete(Block block)
 {
     dbCon.Blocks.Remove(block);
     dbCon.SaveChanges();
 }
Пример #7
0
 public void Create(Block block)
 {
     dbCon.Blocks.Add(block);
     dbCon.SaveChanges();
 }