public async Task DeletePassenger(PassengerRegistration passengerRegistration) { try { await _passengerGenericRepository.DeleteAsync(passengerRegistration); } catch (Exception ex) { throw ex; } }
public async Task <PassengerRegistration> ViewPassengerById(int ID) { PassengerRegistration passenger = null; try { passenger = await _passengerGenericRepository.FindByConditionAsync(x => x.ID.Equals(ID)); } catch (Exception ex) { throw ex; } return(passenger); }
public async Task RegisterPassenger(PassengerRegistration passengerRegistration) { try { if (passengerRegistration != null) { passengerRegistration.CreatedDTTM = DateTime.Now; passengerRegistration.UpdatedDTTM = DateTime.Now; var result = await _passengerGenericRepository.AddAsync(passengerRegistration); } } catch (Exception ex) { } }
public async Task UpdatePassenger(PassengerRegistration passengerRegistration) { try { if (passengerRegistration != null) { var passenger = await _passengerGenericRepository.FindByConditionAsync(x => x.ID.Equals(passengerRegistration.ID)); passenger.UpdatedDTTM = DateTime.Now; passenger.PassengerContact = passengerRegistration.PassengerContact; passenger.PassengerEmail = passengerRegistration.PassengerEmail; passenger.PassengerAge = passengerRegistration.PassengerAge; await _passengerGenericRepository.UpdateAsync(passenger, passenger.ID); } } catch (Exception ex) { } }
public ActionResult Registration(PassengerRegistration model) { Passenger passenger = new Passenger(); passenger.UserFirstName = model.UserFirstName; passenger.UserLastName = model.UserLastName; passenger.UserEmail = model.UserEmail; passenger.UserPhNo = model.UserPhNo; passenger.Password = model.Password; if (!ModelState.IsValid) { return(View(model)); } db.Passengers.Add(passenger); db.SaveChanges(); Session["user"] = passenger.Id; Session["userName"] = passenger.UserFirstName; return(RedirectToAction("Index", "Home")); }