public async Task <IActionResult> Create([Bind("DayId,Name,CreatedDateTime,LastModifiedDateTime")] Day day) { if (ModelState.IsValid) { _context.Add(day); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(day)); }
public async Task <IActionResult> Create([Bind("StatusId,Name,CreatedDateTime,LastModifiedDateTime")] AppointmentStatus appointmentStatus) { if (ModelState.IsValid) { _context.Add(appointmentStatus); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(appointmentStatus)); }
public async Task <IActionResult> Create([Bind("TimeSegmentId,TimeStart,TimeEnd,CreatedDateTime,LastModifiedDateTime")] TimeSegment timeSegment) { if (ModelState.IsValid) { _context.Add(timeSegment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(timeSegment)); }
public async Task <IActionResult> Create([Bind("PatientId,FirstName,LastName,Address,DateOfBirth,PhoneNumber,CreatedDateTime,LastModifiedDateTime")] Patient patient) { if (ModelState.IsValid) { _context.Add(patient); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(patient)); }
public async Task <IActionResult> Create([Bind("PositionId,AppointmentPercentage,BaseRate,PositionName,CreatedDateTime,LastModifiedDateTime")] Position position) { if (ModelState.IsValid) { _context.Add(position); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(position)); }
public async Task <IActionResult> Create([Bind("OfficeId,Address,CityId,CreatedDateTime,LastModifiedDateTime")] Office office) { if (ModelState.IsValid) { _context.Add(office); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.Cities, "CityId", "Name", office.CityId); return(View(office)); }
public async Task <IActionResult> Create([Bind("ServiceId,Price,Name,Description,ServiceTypeId,CreatedDateTime,LastModifiedDateTime")] Service service) { if (ModelState.IsValid) { _context.Add(service); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ServiceTypeId"] = new SelectList(_context.ServiceTypes, "ServiceTypeId", "Name", service.ServiceTypeId); return(View(service)); }
public async Task <IActionResult> Create([Bind("ScheduleId,DayId,TimeSegmentId,CreatedDateTime,LastModifiedDateTime")] Schedule schedule) { if (ModelState.IsValid) { _context.Add(schedule); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DayId"] = new SelectList(_context.Days, "DayId", "Name", schedule.DayId); ViewData["TimeSegmentId"] = new SelectList(_context.TimeSegments, "TimeSegmentId", "TimeSegmentId", schedule.TimeSegmentId); return(View(schedule)); }
public async Task <IActionResult> Create([Bind("Id,WorkerId,ScheduleId,CreatedDateTime,LastModifiedDateTime")] WorkerSchedule workerSchedule) { if (ModelState.IsValid) { _context.Add(workerSchedule); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ScheduleId"] = new SelectList(_context.Schedules, "ScheduleId", "ScheduleId", workerSchedule.ScheduleId); ViewData["WorkerId"] = new SelectList(_context.Workers, "WorkerId", "Address", workerSchedule.WorkerId); return(View(workerSchedule)); }
public async Task <IActionResult> Create([Bind("WorkerId,FirstName,LastName,PhoneNumber,Email,Password,Address,PositionId,OfficeId,CreatedDateTime,LastModifiedDateTime")] Worker worker) { if (ModelState.IsValid) { _context.Add(worker); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OfficeId"] = new SelectList(_context.Offices, "OfficeId", "Address", worker.OfficeId); ViewData["PositionId"] = new SelectList(_context.Positions, "PositionId", "PositionName", worker.PositionId); return(View(worker)); }
public async Task <IActionResult> Create([Bind("AppointmentId,AppointmentDate,Notes,RealEndTime,AppointmentTime,WorkerId,PatientId,StatusId,CreatedDateTime,LastModifiedDateTime,TotalSum")] Appointment appointment) { if (ModelState.IsValid) { _context.Add(appointment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PatientId"] = new SelectList(_context.Patients, "PatientId", "Address", appointment.PatientId); ViewData["StatusId"] = new SelectList(_context.AppointmentStatuses, "StatusId", "Name", appointment.StatusId); ViewData["WorkerId"] = new SelectList(_context.Workers, "WorkerId", "Address", appointment.WorkerId); return(View(appointment)); }
public async Task <IActionResult> Create([Bind("Id,ServiceId,AppointmentId,Amount,CreatedDateTime,LastModifiedDateTime")] AppointmentService appointmentService) { if (ModelState.IsValid) { _context.Add(appointmentService); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } //ViewData["AppointmentId"] = new SelectList(_context.Appointments, "AppointmentId", "Notes", appointmentService.AppointmentId); ViewData["AppointmentId"] = new SelectList(_context.Appointments, "AppointmentId", "Notes", appointmentService.AppointmentId); ViewData["ServiceId"] = new SelectList(_context.Services, "ServiceId", "Description", appointmentService.ServiceId); return(View(appointmentService)); }
//public async Task<IActionResult> Create([Bind("AppointmentPaymentId,TransactionNumber,AppointmentId,Total,CreatedDateTime,LastModifiedDateTime")] AppointmentPayment appointmentPayment) //{ // if (ModelState.IsValid) // { // _context.Add(appointmentPayment); // await _context.SaveChangesAsync(); // return RedirectToAction(nameof(Index)); // } // ViewData["AppointmentId"] = new SelectList(_context.Appointments, "AppointmentId", "Notes", appointmentPayment.AppointmentId); // return View(appointmentPayment); //} public async Task <IActionResult> Create([Bind("AppointmentPaymentId,TransactionNumber,AppointmentId,Total,CreatedDateTime,LastModifiedDateTime")] AppointmentPayment appointmentPayment) { Random rnd = new Random(); appointmentPayment.TransactionNumber = rnd.Next(1, 100); if (ModelState.IsValid) { _context.Add(appointmentPayment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AppointmentId"] = new SelectList(_context.Appointments, "AppointmentId", "Notes", appointmentPayment.AppointmentId); return(View(appointmentPayment)); }
public async Task <IActionResult> Create([Bind("SalaryPaymentId,MonthNumber,Year,Amount,WorkerId,CreatedDateTime,LastModifiedDateTime")] SalaryPayment salaryPayment) { Random rnd = new Random(); salaryPayment.TransactionNumber = rnd.Next(1, 100); if (ModelState.IsValid) { _context.Add(salaryPayment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } var selectList = _context.Workers .Select(w => new { w.WorkerId, CompoundWorker = $"{w.FirstName} {w.LastName}" }); //ViewData["OfficeId"] = new SelectList(selectList, "OfficeId", "CompoundAddress", worker.OfficeId); ViewData["WorkerId"] = new SelectList(selectList, "WorkerId", "CompoundWorker", salaryPayment.WorkerId); //ViewData["WorkerId"] = new SelectList(_context.Workers, "WorkerId", "Address", salaryPayment.WorkerId); return(View(salaryPayment)); }