public ApplicationUser Add(ApplicationUser entity) { var v = _context.Users.Where(x => x.Email == entity.Email); if (v.FirstOrDefault() != null) { return(null); } _context.Add(entity); return(entity); }
public async Task <IActionResult> Create([Bind("JobOfferId,FirstName,LastName,PhoneNumber,EmailAddress,ContactAgreement")] JobApplication jobApplication) { jobApplication.ApplicationDate = DateTime.Now; jobApplication.UserId = 2;//TODO; if (ModelState.IsValid) { _context.Add(jobApplication); await _context.SaveChangesAsync(); return(RedirectToAction("Edit", new { id = jobApplication.Id })); } return(View(jobApplication)); }
public async Task <IActionResult> Create([Bind("Id,CompanyId,Position,Description,SalaryFrom,SalaryTo,IsActive,DatePosted,DateExpiration,UserPosting,UserApply")] JobOffer jobOffer) { jobOffer.IsActive = true; jobOffer.UserId = 2;//TODO jobOffer.DatePosted = DateTime.Now; if (ModelState.IsValid) { try { _context.Add(jobOffer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } catch { return(NotFound()); } } return(View(jobOffer)); }
public JobOffer Add(JobOffer entity) { _context.Add(entity); return(entity); }