public async Task <IActionResult> Create([Bind("OrderId,Quantity,Price,PaymentForm,CreationDate,PaymentDate,ReleaseDate,CancelationDate,CanfirmationDate,Status,IsConfirmedByBuyer,BookId,UserId,SellerId,Seller")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Book, "BookId", "ISBN", order.BookId); ViewData["UserId"] = new SelectList(_context.User, "UserId", "CreditcardName", order.UserId); return(View(order)); }
public async Task <IActionResult> Create([Bind("BookConditionId,Condition")] BookCondition bookCondition) { if (ModelState.IsValid) { _context.Add(bookCondition); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bookCondition)); }
public async Task <IActionResult> Create([Bind("InstitutionId,InstitutionName")] Institution institution) { if (ModelState.IsValid) { _context.Add(institution); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(institution)); }
public async Task <IActionResult> Create([Bind("LocalizationId,PostalCode,PlaceName,Province")] Localization localization) { if (ModelState.IsValid) { _context.Add(localization); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(localization)); }
public async Task <IActionResult> Create([Bind("StudyAreaId,StudyAreaName")] StudyArea studyArea) { if (ModelState.IsValid) { _context.Add(studyArea); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(studyArea)); }
public async Task <IActionResult> Create([Bind("InstitutionBranchId,InstitutionBranchName,InstitutionId")] InstitutionBranch institutionBranch) { if (ModelState.IsValid) { _context.Add(institutionBranch); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["InstitutionId"] = new SelectList(_context.Institution, "InstitutionId", "InstitutionName", institutionBranch.InstitutionId); return(View(institutionBranch)); }
public async Task <IActionResult> Create([Bind("ClaimMediationId,Description,Action,ClaimId")] ClaimMediation claimMediation) { if (ModelState.IsValid) { _context.Add(claimMediation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClaimId"] = new SelectList(_context.Claim, "ClaimId", "Description", claimMediation.ClaimId); return(View(claimMediation)); }
public async Task <IActionResult> Create([Bind("UserId,UserName,FirstName,MiddleName,LastName,UserType,Address,Number,AddressComplement,Age,Email,Phone,Creditcard,CreditcardSecurityCode,CredicardExpirationDate,LocalizationId,InstitutionBranchId")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["InstitutionBranchId"] = new SelectList(_context.InstitutionBranch, "InstitutionBranchId", "InstitutionBranchName", user.InstitutionBranchId); ViewData["LocalizationId"] = new SelectList(_context.Localization, "LocalizationId", "PlaceName", user.LocalizationId); return(View(user)); }
public async Task <IActionResult> Create([Bind("CourseId,CourseName,StudyAreaId,InstitutionId")] Course course) { if (ModelState.IsValid) { _context.Add(course); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["InstitutionId"] = new SelectList(_context.Institution, "InstitutionId", "InstitutionName", course.InstitutionId); ViewData["StudyAreaId"] = new SelectList(_context.StudyArea, "StudyAreaId", "StudyAreaName", course.StudyAreaId); return(View(course)); }
public async Task <IActionResult> Create([Bind("CustomerId,FullName,Email,PostCode,CodeNumber,Message")] CustomerService customerService) { // string LogedUser = this.User.Identity.Name; // customerService.Email = LogedUser; if (ModelState.IsValid) { _context.Add(customerService); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customerService)); }
public async Task <IActionResult> Create([Bind("ClaimId,Description,Status,OrderId,UserId")] Claim claim) { if (ModelState.IsValid) { _context.Add(claim); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrderId"] = new SelectList(_context.Order, "OrderId", "OrderId", claim.OrderId); ViewData["UserId"] = new SelectList(_context.User, "UserId", "Discriminator", claim.UserId); return(View(claim)); }
public async Task <IActionResult> Create(int BookId, string Title, string Description, string ISBN, string Publisher , int Edition, int Quantity, double Price, int BookConditionId, int StudyAreaId, IFormFile PhotoFileName) { Book book = new Book { Blocked = false, BookConditionId = BookConditionId, CreationDate = DateTime.Now, Description = Description, Edition = Edition, ISBN = ISBN, IsWaitList = false, Price = Price, Publisher = Publisher, Quantity = Quantity, QuantitySold = 0, StudyAreaId = StudyAreaId, Title = Title }; string LogedUser = this.User.Identity.Name; var user = (from s in _context.User where s.UserName == LogedUser select s.UserId).ToList(); int UserId = user[0]; if (UserId > 0) { book.UserId = UserId; if (PhotoFileName != null) { using (MemoryStream ms = new MemoryStream()) { await PhotoFileName.CopyToAsync(ms); book.PhotoFileName = ms.ToArray(); } } if (ModelState.IsValid) { _context.Add(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } ViewData["BookConditionId"] = new SelectList(_context.BookCondition, "BookConditionId", "Condition", book.BookConditionId); ViewData["SellerId"] = new SelectList(_context.Set <Seller>(), "UserId", "Discriminator", book.UserId); ViewData["StudyAreaId"] = new SelectList(_context.StudyArea, "StudyAreaId", "StudyAreaName", book.StudyAreaId); return(View(book)); }
public async Task <IActionResult> Create([Bind("BookId,Title,Description,ISBN,Publisher,Edition,Quantity,Price,Visualizations,QuantitySold,Blocked,IsWaitList,CreationDate,BookConditionId,StudyAreaId,SellerId")] Book book) { if (ModelState.IsValid) { _context.Add(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BookConditionId"] = new SelectList(_context.BookCondition, "BookConditionId", "Condition", book.BookConditionId); ViewData["SellerId"] = new SelectList(_context.Set <Seller>(), "UserId", "Discriminator", book.SellerId); ViewData["StudyAreaId"] = new SelectList(_context.StudyArea, "StudyAreaId", "StudyAreaName", book.StudyAreaId); return(View(book)); }
public async Task <IActionResult> Create([Bind("UserId,UserName,FirstName,MiddleName,LastName,UserType,Address,Number,AddressComplement,Age,Email,Phone,Creditcard,CreditcardName,LocalizationId,InstitutionBranchId,isBlocked")] User user) { user.Email = user.UserName; if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction("BooksCatalog", "Books")); //return RedirectToAction(nameof(Index)); } var lista = from l in _context.InstitutionBranch.Include(b => b.Institution) select new { l.InstitutionBranchId, item = "Institution : " + l.Institution.InstitutionName + " / Campus : " + l.InstitutionBranchName, }; ViewData["InstitutionBranchId"] = new SelectList(lista, "InstitutionBranchId", "item"); ViewData["LocalizationId"] = new SelectList(_context.Localization, "LocalizationId", "PlaceName"); return(View(user)); }