//Save Crew public CrewEdit SaveCrew(CrewEdit model) { if (model != null && Guid.TryParse(model.JobId, out Guid jobid)) { using (var context = new CloudbassContext()) { var crew = new Models.Crew() { JobId = jobid, has_RoleId = model.has_RoleId, start_date = model.start_date, end_date = model.end_date, totalDays = model.totalDays, }; context.Crews.Add(crew); context.SaveChanges(); return(model); } } // Return false if customeredit == null or CustomerID is not a guid return(null); }
public ActionResult CreateCrewPartial(CrewEdit model) { if (ModelState.IsValid) { var repo = new JobRepository(); var updatedModel = repo.SaveCrew(model); if (updatedModel != null) { return(RedirectToAction("Edit", new { id = model.JobId })); } } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }
public ActionResult BookingTypePartial(Models.ViewModels.BookingType model) { if (ModelState.IsValid && !String.IsNullOrWhiteSpace(model.JobId)) { switch (model.SelectedBookingType) { case "Schedule": var scheduleModel = new ScheduleEdit() // var scheduleModel = new Schedule() { JobId = model.JobId }; return(PartialView("CreateSchedulePartial", scheduleModel)); case "Crew": var crewModel = new CrewEdit() // var crewModel = new Crew() { JobId = model.JobId }; return(PartialView("CreateCrewPartial", crewModel)); //case "BookingFleet": // var fleetModel = new BookingFleet() // { // JobId = model.JobId // }; // return PartialView("CreateBookingFleetPartial", fleetModel); // case "BookingHotel": // var hotelModel = new BookingHotel() // { // JobId = model.JobId // }; // return PartialView("CreateBookingHotelPartial", hotelModel); // case "BookingKit": // var kitModel = new BookingKit() // { // JobId = model.JobId // }; // return PartialView("CreateBookingKitPartial", kitModel); // case "BookingEquipment": // var equipmentModel = new BookingEquipment() // { // JobId = model.JobId // }; // //var countriesRepo = new CountriesRepository(); // //postalAddressModel.Countries = countriesRepo.GetCountries(); // //var regionsRepo = new RegionsRepository(); // //postalAddressModel.Regions = regionsRepo.GetRegions(); // return PartialView("CreateBookingPartial", equipmentModel); default: return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); }