M_News m_News = new M_News();
m_News.Title = vm_News.Title;
m_News.Text = vm_News.Text;
m_News.IsActive = vm_News.IsActive;
m_News.DateCreated = vm_News.DateCreated;
m_News.P_CategoryNews = new List<M_CategoryNews>();
//_context.Add(m_News);
foreach (var item in vm_News.CategoriesListSelected)
{
M_CategoryNews MTM = new M_CategoryNews();
MTM.M_News = m_News;
M_Category category = _context.db_Category.SingleOrDefault(z => z.IDCategory == item);
MTM.M_Category = category;
_context.Add(MTM);
}
await _context.SaveChangesAsync();