public ActionResult AddAppointment(MakeReservation mr) { Guid id = mr.appId; int fileNum = mr.fileno; if (ModelState.IsValid) { Appointment appointment = new Appointment(); appointment.Id = Guid.NewGuid(); appointment.ClinicId = id; //Get the patient Id using the file number var PatientUser = db.Patients.Where(s => s.FileNumber == fileNum).FirstOrDefault <Patient>(); appointment.PatientId = PatientUser.Id; //Get the receiptionist ID using the logged in user, P.s receiptionist and Admin are objects from AspUser table var userId = User.Identity.GetUserId(); appointment.ReceiptionistId = userId; //Change the default value of status of clinic from false to true, meaning its now reserved var theClinic = db.Clinics.Where(a => a.Id == id).FirstOrDefault <Clinic>(); theClinic.Status = true; db.Appointments.Add(appointment); db.SaveChanges(); } return(RedirectToAction("Index", "Appointments")); }
private void btnMakeReservation_Click(object sender, EventArgs e) { this.Hide(); MakeReservation mr = new MakeReservation(this); mr.Show(); }
public Task Handle(BookAppartment message, IMessageHandlerContext context) { _logger.Info($"Recived BookAppartment, apartments id: {message.ApartmentsId}"); var command = new MakeReservation(); command.ApartmentsId = message.ApartmentsId; _logger.Info($"Sending MakeReservation, apartments id: {message.ApartmentsId}"); return(context.Send(command)); }
public ActionResult AddAppointment() { MakeReservation mr = new MakeReservation(); Guid id = Guid.Parse(TempData["ClinicId"].ToString()); ViewBag.ip = id; mr.appId = id; var ClinicInfo = db.Clinics.Where(s => s.Id == id).FirstOrDefault <Clinic>(); return(View(mr)); }
/// <summary> /// Handle the event. /// </summary> /// <param name="event">The <see cref="IEvent"/> to handle.</param> public Task HandleAsync(OrderCreated @event) { this.spy.Spy("OrderCreated"); if (@event.Count == -1) { throw new InvalidOperationException("Exception on Event"); } MakeReservation makeReservation = new MakeReservation(); return(this.EventContext.Request.Processor.ProcessAsync(makeReservation)); }
public IEnumerable <object> MakeReservation(MakeReservation command) //virtual-workshop ex-7 hint { if (command.TotalRoomTypeAvailable > 0) { RaiseEvent(new ReservationMade(command.Id, command.HotelId, command.RoomType)); } else { RaiseEvent(new ReservationNotMade(command.Id, command.HotelId, command.RoomType, $"The room type {command.RoomType} is currently not available")); } return(base.UnCommitedEvents); }
public ReservationsControllerTest() { makeReservation = new MakeReservation { Name = "정진욱", NumberOfPeople = 2, Destination = "하와이", MobileNumber = "010-1234-1234", StartDate = DateTimeOffset.Now + TimeSpan.FromDays(2), EndDate = DateTimeOffset.Now + TimeSpan.FromDays(4) }; }
public Task Handle(MakeReservation message, IMessageHandlerContext context) { _logger.Info($"MakeReservation message recived, apartments id: {message.ApartmentsId}"); var @event = new ApartmentsReserved(); Guid ReservationId = Guid.NewGuid(); @event.ApartmentsId = message.ApartmentsId; @event.ReservationId = ReservationId; Data.IsReserved = true; _logger.Info($"ApartmentsReserved event publishing, apartments id: {message.ApartmentsId}, reservation id: {ReservationId}"); return(context.Publish(@event)); }
public async Task <IActionResult> Create([Bind("BookId,ReservationDate")] MakeReservation makeReservation) { if (ModelState.IsValid) { TimeSpan razlika = makeReservation.ReservationDate - System.DateTime.Now; if (razlika.Days <= 3) { Reservations reservation = new Reservations(); reservation.Reservationstatus = false; reservation.Reservationdate = makeReservation.ReservationDate; reservation.Profileid = Int32.Parse(_httpContextAccessor.HttpContext.Request.Cookies["id"]); var maxId = 0; if (_context.Reservations.Count() == 0) { maxId = 0; } else { maxId = _context.Reservations.Max(x => x.Id); } reservation.Id = ++maxId; _context.Add(reservation); await _context.SaveChangesAsync(); int newId = reservation.Id; Reservedby reservedBy = new Reservedby(); reservedBy.Bookid = makeReservation.BookId; reservedBy.Reservationid = newId; _context.Add(reservedBy); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } else { ViewBag.Error = "true"; return(RedirectToAction(nameof(Index))); } } //ViewData["Books"] = new SelectList(_context.Books, "Id", "Bookname", makeReservation.BookId); ViewBag.UserId = _httpContextAccessor.HttpContext.Request.Cookies["id"]; ViewBag.UserName = _httpContextAccessor.HttpContext.Request.Cookies["username"]; ViewBag.UserRole = _httpContextAccessor.HttpContext.Request.Cookies["userrole"]; return(View(makeReservation)); }
public IEnumerable <object> Make(MakeReservation command) { RaiseEvent(new ReservationMade(command.ReservationId, command.HotelId, command.ViewId, command.RoomType, DateTime.UtcNow)); return(base.UnCommitedEvents); }
public TripController() { reserv = new MakeReservation(); }
/// <summary> /// Handle the event. /// </summary> /// <param name="event">The <see cref="IEvent"/> to handle.</param> public Task HandleAsync(OrderCreated @event) { MakeReservation makeReservation = new MakeReservation(); return(this.EventContext.Request.Processor.ProcessAsync(makeReservation)); }
public TripController() { reserv = new MakeReservation(); }