Exemplo n.º 1
0
 public ActionResult StudentUpdate(StudentViewViewModel item)
 {
     try
     {
         studentService.Update(Mapper.Map <Student>(item.Student), item.Student.StudentId);
         studentMoreService.Update(Mapper.Map <StudentMore>(item.StudentMore), item.Student.StudentId);
         return(ActionResultProcess.Success());
     }
     catch (Exception ex)
     {
         return(ActionResultProcess.Error(ex));
     }
 }
Exemplo n.º 2
0
 public ActionResult StudentCreate(StudentViewViewModel item)
 {
     try
     {
         Student s = studentService.Create(Mapper.Map <Student>(item.Student));
         StudentMoreViewModel studentMore = item.StudentMore;
         studentMore.StudentId = s.StudentId;
         studentMoreService.Create(Mapper.Map <StudentMore>(item.StudentMore));
         return(ActionResultProcess.Success());
     }
     catch (Exception ex)
     {
         return(ActionResultProcess.Error(ex));
     }
 }
Exemplo n.º 3
0
        public ActionResult StudentReadSingle(int id)
        {
            try
            {
                var result = new StudentViewViewModel()
                {
                    Student     = Mapper.Map <StudentViewModel>(studentService.Read(id)),
                    StudentMore = Mapper.Map <StudentMoreViewModel>(studentMoreService.Read(id))
                };

                return(ActionResultProcess.Success(result));
            }
            catch (Exception ex)
            {
                return(ActionResultProcess.Error(ex));
            }
        }
        private void MainWindow_OnInitialized(object sender, EventArgs e)
        {
            _sTvvm = (StudentViewViewModel)DataContext;
            _sHvvm = (ShiftViewViewModel)MainPanel.DataContext;

            if (_sHvvm.Shifts.Count != 0)
            {
                var shift = _sHvvm.Shifts.FirstOrDefault(x => x.ShiftType == ShiftType.Lunch);
                if (shift.StartTime.Value.Hour.CompareTo(DateTime.Now.Hour) <= 0 && shift.EndTime.Value.Hour.CompareTo(DateTime.Now.Hour) >= 0)
                {
                    ShiftLabel.Content = "Lunch";
                    return;
                }

                shift = _sHvvm.Shifts.FirstOrDefault(x => x.ShiftType == ShiftType.Dinner);
                if (shift.StartTime.Value.Hour.CompareTo(DateTime.Now.Hour) <= 0 && shift.EndTime.Value.Hour.CompareTo(DateTime.Now.Hour) >= 0)
                {
                    ShiftLabel.Content = "Dinner";
                    return;
                }

                ShiftLabel.Content = "";
            }
        }