public async Task <IActionResult> Create([Bind("ProductId,Description,Ovation,Decoration,Legacy,Size,Price,ProductCode,AllowedToSelectId,UpChargeForLegacy,UpChargeAmount,ProductCategory,Color,Color1,Color2,Comments,PhotoImage")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("EmployeeId,CanDoFollowUps,Title,FirstName,LastName,MiddleName,Address,City,State,ZipCode,County,Email,Phone1,PhoneType1,Active,PhotoImage,PlantId,SelectedAnswer")] Employee employee) { if (ModelState.IsValid) { if (employee.SelectedAnswer == 1) { employee.Active = "Yes"; } else { employee.Active = "No"; } var plant = new Plant(); plant = await _context.Plants.FindAsync(employee.PlantId); employee.PlantEmployee = new Plant(); employee.PlantEmployee = plant; _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(Create))); }
public async Task <IActionResult> Create([Bind("TruckId,AcquisitionDate,PlantId,DriverEmployeeId,DriverName,Make,Model,Year,Type,RegCounty,Vin,Tonnage,LicPlateRenewal,RegFee,TruckNumber,Inactive,InactiveReason")] Truck truck) { if (ModelState.IsValid) { var plant = new Plant(); plant = await _context.Plants.FindAsync(truck.PlantId); truck.AssignedPlant = new Plant(); truck.AssignedPlant = plant; Employee e = new Employee(); e = await _context.Employee.FindAsync(truck.DriverEmployeeId); if (e.FirstName != null) { truck.DriverName = e.FirstName + " " + e.LastName; } _context.Add(truck); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(RedirectToAction(nameof(Create))); }
public async Task <IActionResult> Create([Bind("PlantId,PlantName,PlantManagerEmail,PlantManagerTxtNum,PlantManager,Address,Address2,City,State,ZipCode,County,PrintCompletedOrders,Phone1,Phone2,PhoneType1,PhoneType2")] Plant plant) { if (ModelState.IsValid) { _context.Add(plant); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(plant)); }
public async Task <IActionResult> Create([Bind("VaultOrderId,strFuneralDate,FuneralDate," + "CemetaryTime,strCemeteryTime,Location,GraveLocationSection,OrderingPlantId," + "OrderingPlantName,DeliveringPlantId,DeliveringPlantName,ZipCode,FuneralHomeId," + "NewFuneralHome,FuneralDirector,NewFuneralDirector,CemetaryId,Status,Category,VaultId," + "VenetianCarapace,TentWith6Chairs,ExtraChairs,RegisterStand,MilitarySetup,AwningOverCasket," + "Fdrequest,VaultOrderNotes,PlantId,ContactId," + "Salutation,FirstName,MiddleName,LastName,FullName,Suffix,BornDate,DiedDate")] VaultOrder vaultOrder) { if (ModelState.IsValid) { if (vaultOrder.OrderingPlantId != 0) { var ordPlant = new Plant(); ordPlant = await _context.Plants.FindAsync(vaultOrder.OrderingPlantId); vaultOrder.OrderingPlantName = ordPlant.PlantName; } if (vaultOrder.DeliveringPlantId != 0) { var delPlant = new Plant(); delPlant = await _context.Plants.FindAsync(vaultOrder.DeliveringPlantId); vaultOrder.DeliveringPlantName = delPlant.PlantName; } if (vaultOrder.FuneralHomeId != 0) { vaultOrder.funeralhome = (from f in _context.FuneralHomes.Where(i => i.FuneralHomeId == vaultOrder.FuneralHomeId) select f.Name).FirstOrDefault(); } if (vaultOrder.FuneralHomeContactId != 0) { vaultOrder.FuneralDirector = (from f in _context.FuneralHomeContacts.Where(i => i.FuneralHomeContactId == vaultOrder.FuneralHomeContactId) select f.FullName).FirstOrDefault(); } _context.Add(vaultOrder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(vaultOrder)); }
public async Task <IActionResult> Create(int Id, [Bind("FuneralHomeContactId,FuneralHomeId,FirstName,LastName,NickName,Email,Phone1," + "Phone2,Phone3,PhoneType1,PhoneType2,PhoneType3,Spouse," + "ShowPrices,ContactRole,Interests,Photo")] FuneralHomeContact funeralHomeContact) { if (Id == 0) { return(NotFound()); } if (ModelState.IsValid) { funeralHomeContact.FullName = funeralHomeContact.FirstName + " " + funeralHomeContact.LastName; _context.Add(funeralHomeContact); await _context.SaveChangesAsync(); return(RedirectToAction("Details", "FuneralHomes", new { Id = funeralHomeContact.FuneralHomeId })); } return(View(funeralHomeContact)); }
public async Task <IActionResult> Create([Bind("CemetaryId,Name,Address,City,State,ZipCode,County," + "Phone1,PhoneType1,PlantId,PlantName,Directions,Lattitude,Longitude,Map,UseCoordinates")] Cemetary cemetary) { if (ModelState.IsValid) { _context.Add(cemetary); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } if (cemetary.PlantId != 0) { Plant plt = await _context.Plants.FindAsync(cemetary.PlantId); cemetary.PlantName = plt.PlantName; } return(View(cemetary)); }
public async Task <IActionResult> Create([Bind("InteractionId,Date,Nature,Notes,FollowUpDate,Reason,Completed,Outcome,FuneralHomeId,SelectedAnswer")] Interaction interaction) { if (ModelState.IsValid) { if (interaction.SelectedAnswer == 1) { interaction.Completed = "Yes"; } else { interaction.Completed = "No"; } _context.Add(interaction); await _context.SaveChangesAsync(); return(RedirectToAction("Details", "FuneralHomes", new { Id = interaction.FuneralHomeId })); } return(View(interaction)); }