public ActionResult Schedule(string search) { var context = new PowiEntities3(); var ems = context.PersonalInfo.Where(e => e.PersonellNumber == search).FirstOrDefault(); //Hämtar schemat ifrån Serverna string convertSocToString = Convert.ToString(ems); var scheduleCode = (from persons in db.PersonalInfo where persons.PersonellNumber == convertSocToString select persons.ScheduleCode).FirstOrDefault(); //Get the list from service and shows in the view List <ScheduleDataWithSoc> listToView = new List <ScheduleDataWithSoc>(); List <ServiceReference1.ScheduleFileCon> listFromService = client.GetSchedule(scheduleCode).ToList(); foreach (var post in listFromService) { ScheduleDataWithSoc listObject = new ScheduleDataWithSoc { id = post.idValue, week = post.weekValue, day = post.dayValue, time = post.timeValue, ScheduleCode = post.scheduleCodeValue, soc = convertSocToString }; listToView.Add(listObject); } return(View(listToView)); }
public ActionResult Report(string search) { //Söker efter person i datbasen var context = new PowiEntities3(); var ems = context.PersonalInfo.Where(e => e.PersonellNumber == search).FirstOrDefault(); if (ems != null) { return(View(ems)); } else { return(View("Error")); } }