Esempio n. 1
0
 public void Post([FromBody] Reservation reservation)
 {
     reservation.FlexDesk = flexdeskProvider.GetById(reservation.FlexDeskId);
     reservation.User     = userProvider.GetById(reservation.UserId);
     reservationBll.CreateReservation(reservation);
     //reservationProcessor.Create(reservation);
 }
        public IActionResult NewReservation(long flexDesk, DateTime start, DateTime end, long user)
        {
            activeUser = userBll.GetUserById((long)HttpContext.Session.GetInt32("userId"));
            ViewData["sessionData"] = new int?[] { HttpContext.Session.GetInt32("admin"), HttpContext.Session.GetInt32("language") };

            if (user == activeUser.UserId || activeUser.Administrator > 0)
            {
                Reservation res = new Reservation();
                res.FlexDeskId   = flexDesk;
                res.UserId       = user;
                res.StartDate    = start;
                res.EndDate      = end;
                res.UserId       = user;
                res.Creator      = (int)activeUser.UserId;
                res.CreationDate = DateTime.Now;
                reservationBll.CreateReservation(res);

                rvm.UserId                      = user;
                rvm.User                        = userBll.GetUserById(user);
                rvm.UserCode                    = rvm.User.Login;
                rvm.Start                       = res.StartDate;
                rvm.End                         = res.EndDate;
                rvm.ActiveUser                  = activeUser;
                rvm.Dictionary                  = new Dictionary(HttpContext.Session.GetInt32("language"));
                rvm.ReservationFloor            = floorBll.GetFloorById(departmentBll.GetDepartmentById(flexDeskBll.GetFlexDeskById(res.FlexDeskId).DepartmentId).FloorId);
                rvm.ReservationUser             = new ReservationFE(flexDeskBll, res);
                rvm.ReservationUser.NameCreator = activeUser.FirstName + " " + activeUser.Name;
                UpdateRvm(rvm);
                return(View(rvm));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Esempio n. 3
0
 public void Post([FromBody] Reservation reservation)
 //implementatie REST protocol voor met de JSON code langs front-end overweg te kunnen [FromBody]
 //Het [FromBody] attribuut zal gebruikt worden om het content type te bepalen
 {
     reservation.FlexDesk = flexdeskProvider.GetById(reservation.FlexDeskId);
     reservation.User     = userProvider.GetById(reservation.UserId);
     reservationBll.CreateReservation(reservation);
 }