예제 #1
0
 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));
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        public CategoryLangDTO EditCategory(CategoryLangDTO categoryLangDTO)
        {
#warning Нужно сделать
            throw new NotImplementedException();
        }