示例#1
0
 void fillInfo(TimetableDTO UsedDay)
 {
     this.PName    = UsedDay.Subject;
     this.Teacher  = UsedDay.NameTeacher;
     this.lecType  = UsedDay.TypeLecture;
     this.kabNum   = UsedDay.NumberCabinet;
     this.zoomLink = UsedDay.LinkLecture;
 }
示例#2
0
 public void Update(TimetableDTO newValue)
 {
     CityOrIntercity = newValue.CityOrIntercity;
     Line            = newValue.Line;
     LineId          = newValue.LineId;
     Departures      = newValue.Departures;
     DayOfTheWeek    = newValue.DayOfTheWeek;
 }
示例#3
0
        public void CreateTimetable(TimetableDTO timetableDto)
        {
            Timetable timetable = new Timetable
            {
                PatientId = timetableDto.PatientId,
                DoctorId  = timetableDto.DoctorId,
                StartTime = timetableDto.StartTime,
                EndTime   = timetableDto.EndTime,
            };

            Database.Timetables.Create(timetable);
            Database.Save();
        }
示例#4
0
                public Lecture(TimetableDTO UsedDay)
                {
                    fillInfo(UsedDay);
                    int sg = (int)UsedDay.SubGroupNumber;

                    if (sg > 0)
                    {
                        Lectures[sg - 1] = createLec();
                        if (!isDoule)
                        {
                            isDoule = true;
                        }
                    }
                }
 public ActionResult CreateTimetable(TimetableViewModel timetable)
 {
     try
     {
         var timetableDto = new TimetableDTO {
             DoctorId = timetable.DoctorId, PatientId = timetable.PatientId, StartTime = timetable.StartTime, EndTime = timetable.EndTime
         };
         timetableService.CreateTimetable(timetableDto);
         return(RedirectToAction("Timetables"));
     }
     catch (ValidationException ex)
     {
         ModelState.AddModelError(ex.Property, ex.Message);
     }
     return(View(timetable));
 }
        // POST api/timetables
        public HttpResponseMessage CreateTimetable([FromBody] TimetableDTO timetableDTO)
        {
            Timetable newTimetable = new Timetable();
            Line      l            = unitOfWork.Lines.GetAll().Where(a => a.Id == timetableDTO.LineId).SingleOrDefault();

            newTimetable.CityOrIntercity = timetableDTO.CityOrIntercity;
            newTimetable.DayOfTheWeek    = timetableDTO.DayOfTheWeek;
            newTimetable.Departures      = timetableDTO.Departures;
            newTimetable.Line            = l;
            newTimetable.LineId          = l.Id;

            unitOfWork.Timetables.Add(newTimetable);
            unitOfWork.Complete();

            var message = Request.CreateResponse(HttpStatusCode.Created, newTimetable);

            message.Headers.Location = new Uri(Request.RequestUri + "/" + newTimetable.Id.ToString());

            return(message);
        }
        // PUT api/timetables/5
        public HttpResponseMessage UpdateTimetable(int id, [FromBody] TimetableDTO timetableDTO)
        {
            var  timetableToBeUpdated = unitOfWork.Timetables.Get(id);
            Line l = unitOfWork.Lines.GetAll().Where(x => x.Id == timetableDTO.LineId).SingleOrDefault();

            timetableToBeUpdated.CityOrIntercity = timetableDTO.CityOrIntercity;
            timetableToBeUpdated.DayOfTheWeek    = timetableDTO.DayOfTheWeek;
            timetableToBeUpdated.Departures      = timetableDTO.Departures;
            timetableToBeUpdated.Line            = l;
            timetableToBeUpdated.LineId          = timetableDTO.LineId;

            if (timetableToBeUpdated != null)
            {
                unitOfWork.Timetables.Update(timetableToBeUpdated);
                unitOfWork.Complete();

                return(Request.CreateResponse(HttpStatusCode.OK, timetableToBeUpdated));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Timetable with that id number doesn't exist."));
            }
        }