Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public ActionResult ClothesTypes()
        {
            ClothesTypeRepository clothesTypeRepo = new ClothesTypeRepository();

            return(Json(clothesTypeRepo.GetAllClothingTypes(), JsonRequestBehavior.AllowGet));
        }