public async Task <IActionResult> Create([Bind("Id,StartDate,EndDate,CorroborantTypeId,Name")] Corroborant corroborant, IFormFile UploadLinces, string startdate, string enddate) { FileManager fileManager = new FileManager(_enviroment); if (UploadLinces != null) { corroborant.UploadLinces = await fileManager.InsertFiles(UploadLinces, "image/Document"); } DateTime sdate = Convert.ToDateTime(startdate); DateTime edate = Convert.ToDateTime(enddate); if (ModelState.IsValid) { corroborant.StartDate = sdate; corroborant.EndDate = edate; _context.Add(corroborant); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CorroborantTypeId"] = new SelectList(_context.Corroborants, "Id", "Id", corroborant.CorroborantTypeId); return(View(corroborant)); }
public async Task <IActionResult> Create([Bind("Name,RecordNumber,RecordDate,RecordPlace,CompanyStartDate," + "FactoryStartDate,FactoryUseDate,NationalId,EconomicCode,UseLicenseNumber,UseLicenseDate," + "ActivityDescription,MaterialList,Randd,ConstructionMetod,QcProgram,ResearchMember" + ",CompanyTypeId,OwnershipTypeId,CarId,LicenseId")] Company company, IFormFile UploadDocuments, IFormFile UploadUseLicensePic, IFormFile UploadStatutePic, IFormFile UploadOfficialnewspapers, IFormFile UploadProductCatalog, IFormFile UploadMemberOfTheInstitute) { FileManager fileManager = new FileManager(_enviroment); if (UploadDocuments != null) { company.UploadDocuments = await fileManager.InsertFiles(UploadDocuments, "image/Document"); } if (UploadUseLicensePic != null) { company.UploadUseLicensePic = await fileManager.InsertFiles(UploadUseLicensePic, "image/Document"); } if (UploadStatutePic != null) { company.UploadStatutePic = await fileManager.InsertFiles(UploadStatutePic, "image/Document"); } if (UploadOfficialnewspapers != null) { company.UploadOfficialnewspapers = await fileManager.InsertFiles(UploadOfficialnewspapers, "image/Document"); } if (UploadProductCatalog != null) { company.UploadProductCatalog = await fileManager.InsertFiles(UploadProductCatalog, "image/Document"); } if (UploadMemberOfTheInstitute != null) { company.UploadMemberOfTheInstitute = await fileManager.InsertFiles(UploadMemberOfTheInstitute, "image/Document"); } if (ModelState.IsValid) { _context.Add(company); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); //ViewData["CarId"] = new SelectList(_context.Cars, "Id", "Id", company.Car.CarType.Name); ViewData["CompanyTypeId"] = new SelectList(_context.CompanyTypes, "Id", "Id", company.CompanyType.Id); ViewData["LicenseId"] = new SelectList(_context.Licenses, "Id", "Id", company.License.LicenseType.Name); ViewData["OwnershipTypeId"] = new SelectList(_context.OwnershipType, "Id", "Id", company.OwnershipType.Id); } return(View(company)); }
public async Task <IActionResult> Create([Bind("Id,Name")] LicenseType licenseType) { if (ModelState.IsValid) { _context.Add(licenseType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(licenseType)); }
public async Task <IActionResult> Create([Bind("Id,Name")] ManufacturingGroup manufacturingGroup) { if (ModelState.IsValid) { _context.Add(manufacturingGroup); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(manufacturingGroup)); }
public async Task <IActionResult> Create([Bind("Id,Name,Family,FatherName,NationalCode,IDNumber,BirthDate,DegreeEducation,Tel,Fax,Email,Post,WorkExperience,TheSignatory,CustomerTypeId,UserId")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerTypeId"] = new SelectList(_context.CustomerTypes, "Id", "Id", customer.CustomerTypeId); return(View(customer)); }
public async Task <IActionResult> Create([Bind("Id,StartDate,EndDate,UploadLinces,LicenseTypeId,UserId")] License license) { if (ModelState.IsValid) { _context.Add(license); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LicenseTypeId"] = new SelectList(_context.LicenseTypes, "Id", "Id", license.LicenseTypeId); return(View(license)); }
public async Task <IActionResult> Create([Bind("Id,Year,Amount,ProductId,UserId")] ProductionRate productionRate) { if (ModelState.IsValid) { _context.Add(productionRate); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Id", productionRate.ProductId); return(View(productionRate)); }
public string Register(string tideToken, string publicKey) { var key = GetPublicKey(publicKey); if (!ValidateTideToken(tideToken, key)) { return(null); } var claims = ExtractClaims(tideToken, key); var vuid = claims.First(c => c.Type == "vuid").Value; _context.Add(new VendorUser { PublicKey = publicKey, Vuid = vuid }); _context.SaveChanges(); return(GenerateVendorToken(vuid)); }