Ejemplo n.º 1
0
        public void AddNewLeftNav(LeftNavViewModel leftNav)
        {
            var leftNavEntity = _leftNavModelFactory.CreateLeftNavEntity(leftNav);

            _context.LeftNavs.Add(leftNavEntity);
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
        public void EditLeftNav(LeftNavViewModel leftNav)
        {
            var leftNavEntity = _leftNavModelFactory.CreateLeftNavEntity(leftNav);

            _context.Entry(leftNavEntity).State = EntityState.Modified;
            if (leftNav.Childs != null && leftNav.Childs.Count > 0)
            {
                foreach (var child in leftNav.Childs)
                {
                    if (child.Id == 0)
                    {
                        _context.Entry(child).State = EntityState.Added;
                    }
                    else
                    {
                        _context.Entry(child).State = EntityState.Modified;
                    }
                }
            }
            _context.SaveChanges();
        }
 public LeftNav CreateLeftNavEntity(LeftNavViewModel leftNavViewModel)
 {
     return(Mapper.Map <LeftNavViewModel, LeftNav>(leftNavViewModel));
 }
Ejemplo n.º 4
0
 public IActionResult Put([FromBody] LeftNavViewModel leftNav)
 {
     _leftNavService.EditLeftNav(leftNav);
     return(Ok());
 }
Ejemplo n.º 5
0
 public IActionResult Post([FromBody] LeftNavViewModel leftNav)
 {
     _leftNavService.AddNewLeftNav(leftNav);
     return(Ok());
 }
Ejemplo n.º 6
0
 public void EditLeftNav(LeftNavViewModel leftNav)
 {
     _leftNavRepository.EditLeftNav(leftNav);
 }
Ejemplo n.º 7
0
 public void AddNewLeftNav(LeftNavViewModel leftNavViewModel)
 {
     _leftNavRepository.AddNewLeftNav(leftNavViewModel);
 }