public ActionResult <CategoryLangDTO> GetCategory(int CategoryId, int LangId) { try { CategoryLangDTO category = serv.GetCategory(CategoryId, LangId); return(Ok(category)); } catch (ValidationException ex) { return(Content(ex.Message)); } }
public CategoryLangDTO GetCategory(int CategoryId, int LangId) { CategoryLangLink categoryLangLink = db.CategoryLangLinks.Where(c => c.CategoryId == CategoryId && c.LangId == LangId).FirstOrDefault(); if (categoryLangLink == null) { throw new Exception("Категория не существует"); } Category category = db.Categories.Find(categoryLangLink.CategoryId); CategoryLangDTO categoryLangDTO = new CategoryLangDTO { Description = categoryLangLink.Description, Name = categoryLangLink.Name, LangId = categoryLangLink.LangId, CategoryId = CategoryId, Status = category.Status }; return(categoryLangDTO); }
public CategoryLangDTO EditCategory(CategoryLangDTO categoryLangDTO) { #warning Нужно сделать throw new NotImplementedException(); }