public ActionResult Clothes() { List <ClothesModel> clothesModel = new List <ClothesModel>(); ClothesRepository clothesRepo = new ClothesRepository(); ColorRepository colorRepo = new ColorRepository(); ClothesTypeRepository clothesTypeRepo = new ClothesTypeRepository(); var allCLothes = clothesRepo.GetAllClothes(); foreach (var clothe in allCLothes.OrderBy(c => c.ClothesType)) { clothesModel.Add(new ClothesModel { Id = clothe.Id, AdditionnalNote = clothe.AdditionnalNote == null ? "N/A" : clothe.AdditionnalNote, ClothesType = clothesTypeRepo.GetAllClothingTypes().Where(t => t.Id == clothe.ClothesType).SingleOrDefault().Name, Color = colorRepo.GetAllColors().Where(c => c.Id == clothe.Color).SingleOrDefault().Name, Image = clothe.Image == null ? "" : clothe.Image }); } return(Json(clothesModel, JsonRequestBehavior.AllowGet)); }
public ActionResult ClothesTypes() { ClothesTypeRepository clothesTypeRepo = new ClothesTypeRepository(); return(Json(clothesTypeRepo.GetAllClothingTypes(), JsonRequestBehavior.AllowGet)); }