Ejemplo n.º 1
0
        public async Task <ActionResult> ViewGym(string gymId)
        {
            ViewBag.Title = "ViewGym";

            ExpertiseManager expertisesManager = new ExpertiseManager();

            ViewBag.AllowFriendshipRequest = false;
            var gymProfile = await gymManager.ViewGymProfile(gymId);

            List <string> expertisesIDs = new List <string>();

            foreach (string s in gymProfile.Expertise)
            {
                expertisesIDs.Add(s);
            }
            var expertises = await expertisesManager.FindExpertisesByIds(expertisesIDs);

            ConnectionManager connectionManager = new ConnectionManager();
            bool connectionExists = await connectionManager.CheckConnectionExistence(Request.Cookies["userId"].Value, gymId);

            ViewBag.AllowFriendshipRequest = !connectionExists;
            for (int i = 0; i < gymProfile.Expertise.Length; i++)
            {
                gymProfile.Expertise[i] = expertises[i].ExpertiseName;
            }

            return(View(gymProfile));
            //return View(new UserTrainerProfileDataContext { UserName = "******" });
        }
Ejemplo n.º 2
0
        public async Task <HttpResponseMessage> FindExpertisesList([FromBody] List <string> Ids)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            var result = await ExpertiseManager.FindExpertisesByIds(Ids);

            if (null != result)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            return(Request.CreateResponse(HttpStatusCode.InternalServerError, "something went wrong"));
        }