public async Task <ActionResult> Register([Bind("Id, Email, Password, Name")] User user) { var users = await _context.User.FirstOrDefaultAsync(m => m.Email == user.Email); if (users == null || !user.Email.Equals(users.Email)) { _context.Add(user); await _context.SaveChangesAsync(); return(View("~/Views/Home/RegisterSuccess.cshtml")); } return(View("~/Views/Home/RegisterError.cshtml")); }
public async Task <ActionResult> AddItem([Bind("Id, Name, Price, Quantity, Type")] Instrument instrument) { var instruments = await _context.Instrument.FirstOrDefaultAsync(m => m.Name == instrument.Name); if (instruments == null || !instrument.Name.Equals(instruments.Name)) { _context.Add(instrument); await _context.SaveChangesAsync(); return(View("~/Views/Home/AddItemSuccess.cshtml")); } return(View("~/Views/Home/AddItemError.cshtml")); }