public BodyAreaController(IBodyAreaRepository bAreaRepo, IBodyPartRepository bPartRepo, IMuscleRepository muscleRepo)
 {
     bodyAreaRepository = bAreaRepo;
     bodyPartRepository = bPartRepo;
     muscleRepository   = muscleRepo;
     dbGetter.AssignData(muscleRepository.Muscles.ToList(), bodyAreaRepository.BodyAreas.ToList(), bodyPartRepository.BodyParts.ToList());
 }
Exemple #2
0
        public static BodyAreaViewModel CreateBAreaViewModel(this BodyArea bArea, IBodyAreaRepository bAreaRepo, IBodyPartRepository bPartRepo, DBGetter db)
        {
            BodyAreaViewModel bAreaVM = new BodyAreaViewModel()
            {
                Name        = bArea.Name,
                BodyAreaId  = bArea.BodyAreaId,
                Description = bArea.Description,
                Image       = bArea.Image,
                BodyParts   = bArea.GetBodyPartsVM(db)
            };

            return(bAreaVM);
        }
Exemple #3
0
        public static BodyPartsViewModel CreateBPartViewModel(this IBodyPartRepository bPart, IBodyAreaRepository bodyArea, int?Id, DBGetter db)
        {
            BodyPart           bodyPart = bPart.GetBodyPartById(Id);
            BodyPartsViewModel bPartVM  = new BodyPartsViewModel()
            {
                Name        = bodyPart.Name,
                BodyAreaId  = bodyPart.BodyAreaId,
                Description = bodyPart.Description,
                Image       = bodyPart.Image,
                BodyPartId  = bodyPart.BodyPartId,
                BodyAreas   = bodyArea.BodyAreas.ToList(),
                Muscles     = bodyPart.GetListMuscleVM(db)
            };

            return(bPartVM);
        }
Exemple #4
0
        public static List <BodyAreaViewModel> CreateListBAreaVM(this List <BodyArea> bAreas, IBodyPartRepository bPart, IBodyAreaRepository bAreaRepo, DBGetter db)
        {
            List <BodyAreaViewModel> bAreasVM = new List <BodyAreaViewModel>();

            foreach (var bArea in bAreas)
            {
                bAreasVM.Add(bArea.CreateBAreaViewModel(bAreaRepo, bPart, db));
            }
            return(bAreasVM);
        }