Exemplo n.º 1
0
        // POST: SelectedBooking/BookRoom
        public ActionResult BookRoom(string startDate, string endDate, int roomId)
        {
            DateTimeFormatInfo dk  = new CultureInfo("da-DK", false).DateTimeFormat;
            var startDateConverted = Convert.ToDateTime(startDate, dk);
            var endDateConverted   = Convert.ToDateTime(endDate, dk);

            //var user = _accountGateway.GetUserLoggedIn();
            var booking = new Dll.Entities.Booking()
            {
                //Creator = user,
                Room = new Room {
                    Id = roomId
                },
                FromDate = startDateConverted,
                ToDate   = endDateConverted,
                //Accepted = new List<User>(),
                //Invited = new List<User>()
            };

            var bookingCreated = _bookingGateway.Create(booking);

            if (bookingCreated != null)
            {
                return(RedirectToAction("Bookings", "Profile"));
            }

            return(View(new BookRoomViewModel {
                Room = _roomGateway.Read(roomId), StartDate = startDate, EndDate = endDate, ErrorMessage = "Rummet er allerede booket i det valgte tidsrum"
            }));
        }
Exemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id,FromDate,ToDate")] Dll.Entities.Booking booking)
        {
            if (ModelState.IsValid)
            {
                _bookingGateway.Create(booking);

                return(RedirectToAction("Index"));
            }

            return(View(booking));
        }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Id,Name,Description")] Department department)
        {
            if (ModelState.IsValid)
            {
                _departmentGateway.Create(department);

                return(RedirectToAction("Index"));
            }

            return(View(department));
        }
Exemplo n.º 4
0
        public object Create()
        {
            var source = _gateway.Create <Cycle>();

            return(AutoMapper.Mapper.Map <CycleModel>(source));
        }
Exemplo n.º 5
0
 public Int32 AddArticle(ArticleInfo entity)
 {
     return(dbService.Create(entity));
 }