Пример #1
0
        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));
        }
Пример #2
0
        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();
        }
Пример #3
0
        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);
 }
Пример #5
0
 public IActionResult Registro(Registro r)
 {
     if (ModelState.IsValid)
     {
         _context.Add(r);
         _context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(r));
 }
Пример #6
0
 public IActionResult Producto(Productos p)
 {
     if (ModelState.IsValid)
     {
         _context.Add(p);
         _context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(p));
 }
Пример #7
0
 public IActionResult Formulario(Formulario f)
 {
     if (ModelState.IsValid)
     {
         _context.Add(f);
         _context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(f));
 }
Пример #8
0
        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));
        }
Пример #10
0
        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));
        }
Пример #11
0
        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));
        }
Пример #12
0
        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));
        }
Пример #14
0
        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));
        }
Пример #15
0
        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));
        }
Пример #16
0
        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));
        }
Пример #17
0
        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));
        }
Пример #18
0
        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));
        }
Пример #19
0
        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));
        }
Пример #20
0
        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));
        }
Пример #21
0
        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));
        }
Пример #22
0
        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));
        }
Пример #23
0
        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));
        }
Пример #24
0
        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));
        }
Пример #25
0
        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));
        }
Пример #27
0
        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));
        }
Пример #28
0
        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));
        }
Пример #29
0
        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));
        }