public void AddNewLeftNav(LeftNavViewModel leftNav) { var leftNavEntity = _leftNavModelFactory.CreateLeftNavEntity(leftNav); _context.LeftNavs.Add(leftNavEntity); _context.SaveChanges(); }
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)); }
public IActionResult Put([FromBody] LeftNavViewModel leftNav) { _leftNavService.EditLeftNav(leftNav); return(Ok()); }
public IActionResult Post([FromBody] LeftNavViewModel leftNav) { _leftNavService.AddNewLeftNav(leftNav); return(Ok()); }
public void EditLeftNav(LeftNavViewModel leftNav) { _leftNavRepository.EditLeftNav(leftNav); }
public void AddNewLeftNav(LeftNavViewModel leftNavViewModel) { _leftNavRepository.AddNewLeftNav(leftNavViewModel); }