public async Task <IActionResult> Create(String Author, String Title, DateTime ReleaseDate, String Genre, int Price, String Adress, String email, String password) { Book book = new Book(Author, Title, Adress, ReleaseDate, Genre, Price); if (ModelState.IsValid && _context.User.Any(user => user.Email == email && user.Password == password)) { _context.Add(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(book)); }
public void CreateCart(string username, string productName) { string custId = GetCust(username).Id; string prodId = GetProd(productName).Id; ShoppingCart cart = new ShoppingCart(); cart.Id = Guid.NewGuid().ToString(); cart.CustomerId = custId; cart.ProductId = prodId; cart.ProductQty = 1; dbcontext.Add(cart); dbcontext.SaveChanges(); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Email,SubID")] Webappmaster webappmaster) { if (ModelState.IsValid && webappmaster.SubID != 0) { if (_context.Webappmaster.Count(e => e.Email == webappmaster.Email && e.SubID == webappmaster.SubID) == 0) { if (IsValidEmail(webappmaster.Email)) { _context.Add(webappmaster); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } else { ModelState.AddModelError("Email", "Please enter a valid email address"); } } else { ModelState.AddModelError("Email", "Email already subscribed to that magazine"); } } else { ModelState.AddModelError("SubID", "Please select a magazine"); } return(View(webappmaster)); }
public async Task<IActionResult> Create([Bind("ID,Title,ReleaseDate,Genre,Price")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); } return View(movie); }
public IActionResult Registro(Registro r) { if (ModelState.IsValid) { _context.Add(r); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(r)); }
public IActionResult Producto(Productos p) { if (ModelState.IsValid) { _context.Add(p); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(p)); }
public IActionResult Formulario(Formulario f) { if (ModelState.IsValid) { _context.Add(f); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(f)); }
public async Task <IActionResult> Create([Bind("Id,Name")] Role role) { if (ModelState.IsValid) { _context.Add(role); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(role)); }
public async Task <IActionResult> Create([Bind("Id,Name,RefreshTime")] Site site) { if (ModelState.IsValid) { _context.Add(site); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(site)); }
public async Task <IActionResult> Create([Bind("Id,Name,Color")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("Id,Title,Url")] Bookmark bookmark) { if (ModelState.IsValid) { _context.Add(bookmark); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bookmark)); }
public async Task <IActionResult> Create([Bind("Id,Date,Latitude,Longitude,GeoPolygon,Photo,PhotoName,FileType,Geolocalization,GeoJSON,FireTypeClassification,SmokeTypeClassification,FireScoreClassification,SmokeScoreClassification")] ClassifiedImage classifiedImage) { if (ModelState.IsValid) { _context.Add(classifiedImage); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(classifiedImage)); }
public async Task <IActionResult> Create([Bind("Id,Title,Order")] Process process) { if (ModelState.IsValid) { _context.Add(process); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Deals")); } return(View(process)); }
public async Task <IActionResult> Create([Bind("PersonId,FirstName,LastName,PersonalCode,PersonPaymentMethod,PersonRequests,ParticipantId")] Person person) { if (ModelState.IsValid) { _context.Add(person); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(person)); }
public async Task <IActionResult> Create([Bind("CategoriaID,Nombre,Descripcion,Estado")] Categoria categoria) { if (ModelState.IsValid) { _context.Add(categoria); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(categoria)); }
public async Task <IActionResult> Create([Bind("CompanyId,CompanyName,CompanyRegistrationNr,CompanyPaymentMehtod,NumberOfParticipants,CompanyRequests,ParticipantId")] Company company) { if (ModelState.IsValid) { _context.Add(company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(company)); }
public async Task <IActionResult> Create([Bind("Id,Brand,Model,Year,Hk,Price")] Car car) { if (ModelState.IsValid) { _context.Add(car); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(car)); }
public async Task <IActionResult> Create([Bind("CategoryId,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,Nom,Email,Texte,DateCommentaire")] Commentaire commentaire) { if (ModelState.IsValid) { _context.Add(commentaire); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(commentaire)); }
public async Task <IActionResult> Create([Bind("Id,Name,Phone,Address")] Company company) { if (ModelState.IsValid) { _context.Add(company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(company)); }
public async Task <IActionResult> Create([Bind("ReservationId,DateAndTime,LastName,PeopleNo")] Reservation reservation) { if (ModelState.IsValid) { _context.Add(reservation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(reservation)); }
public async Task <IActionResult> Create([Bind("Departamento,Id")] Department department) { if (ModelState.IsValid) { _context.Add(department); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(department)); }
public async Task <IActionResult> Create([Bind("ID,EventName,EventStartDate,EventLocation,EventInformation")] Event @event) { if (ModelState.IsValid) { _context.Add(@event); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(@event)); }
public async Task <IActionResult> Create([Bind("TypeId,OrderType1")] OrderType orderType) { if (ModelState.IsValid) { _context.Add(orderType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(orderType)); }
public async Task <IActionResult> Create([Bind("Id,Names,BirthDate,Gender,Worth")] People people) { if (ModelState.IsValid) { _context.Add(people); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(people)); }
public async Task <IActionResult> Create([Bind("Id,Name")] Group @group) { if (ModelState.IsValid) { _context.Add(@group); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(@group)); }
public async Task <IActionResult> Create([Bind("Id,FullName,Department, Email, Telephone")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Address,City,State,DateOfBirth,Gender")] Student student) { if (ModelState.IsValid) { _context.Add(student); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Home")); } return(View(student)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,Patronymic,LastName,Phone,Address,CompanyId")] Contact contact) { if (ModelState.IsValid) { _context.Add(contact); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CompanyId"] = new SelectList(_context.Companies, "Id", "Name", contact.CompanyId); return(View(contact)); }
public async Task <IActionResult> Create([Bind("Id,Name,Email,Phone,Message,ProductId")] Feedback feedback) { if (ModelState.IsValid) { _context.Add(feedback); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", feedback.ProductId); return(View(feedback)); }