public async Task <IActionResult> Create([Bind("Id,Name")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("Id,Name,LogoUrl,ImageUrl,Location,WorkingHours,TelephoneNumber,Email,Description,SubCategoryId")] Shop shop) { if (ModelState.IsValid) { _context.Add(shop); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), new { id = TempData["CategoryId"] })); } ViewData["SubCategoryId"] = new SelectList(_context.Subcategory, "Id", "Name", shop.SubCategoryId); return(View(shop)); }
public async Task <IActionResult> Create([Bind("Id,Name,CategoryId")] Subcategory subcategory) { if (ModelState.IsValid) { _context.Add(subcategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Category, "Id", "Name", subcategory.CategoryId); return(View(subcategory)); }
public async Task <IActionResult> Create([Bind("Id,ShopId,EmployeeId,StartDate")] Employment employment) { if (ModelState.IsValid) { _context.Add(employment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employee, "Id", "FullName", employment.EmployeeId); ViewData["ShopId"] = new SelectList(_context.Shop, "Id", "Name", employment.ShopId); return(View(employment)); }
public async Task <IActionResult> Create(Employee entry, IFormFile cvUrl) { Employee employee = new Employee { FirstName = entry.FirstName, LastName = entry.LastName, Email = entry.Email, PictureUrl = entry.PictureUrl, CVUrl = UploadFile(cvUrl) }; if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Apply(Application entry, IFormFile cvUrl) { Application application = new Application { FirstName = entry.FirstName, LastName = entry.LastName, ShopId = entry.ShopId, ApplicationDate = DateTime.Now, CVUrl = UploadFile(cvUrl) }; if (ModelState.IsValid) { _context.Add(application); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Success))); } ViewData["ShopId"] = new SelectList(_context.Shop, "Id", "Name", application.ShopId); return(View(application)); }