public async Task <IActionResult> Create([Bind("Id,RequestId,RequestDesc,SiteId,LocationId,AssetId,AssetDesc,Date,Status")] WoRequestTbl woRequestTbl) { if (ModelState.IsValid) { _context.Add(woRequestTbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(woRequestTbl)); }
public IActionResult signup(String aa, String bb, String cc, String dd, String ee, LoginTbl login) { byte[] salt = new byte[128 / 8]; //using (var rng = RandomNumberGenerator.Create()) //{ // rng.GetBytes(salt); //} //Console.WriteLine($"Salt: {Convert.ToBase64String(salt)}"); // derive a 256-bit subkey (use HMACSHA1 with 10,000 iterations) string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: dd, salt: salt, prf: KeyDerivationPrf.HMACSHA1, iterationCount: 10000, numBytesRequested: 256 / 8)); var a = hashed; login.name = aa; login.Email = bb; login.Username = cc; login.Pass = a; login.type = ee; if (ModelState.IsValid) { _db.Add(login); _db.SaveChangesAsync(); //return RedirectToAction("Index", "Home"); return(Json(new { success = true })); } return(View()); }
public async Task <IActionResult> Create(TaskTbl taskTbl) { if (ModelState.IsValid) { String idrunning = ""; idrunning = generateRunningNumber(idrunning); taskTbl.TaskCode = idrunning; taskTbl.Date = DateTime.Now; taskTbl.CreatedAtTask = DateTime.Now; taskTbl.ModifyAtTask = DateTime.Now; _db.Add(taskTbl); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(taskTbl)); }
public async Task <IActionResult> Create([Bind("Id,Availability,SparepartRequestId,WoId,WoDesc,Date,Status,SiteId,Qty,Notes")] SparepartRequestTbl sparepartRequestTbl) { if (ModelState.IsValid) { _context.Add(sparepartRequestTbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(sparepartRequestTbl)); }
public async Task <IActionResult> Create(SiteMasterTbl siteMaster) { if (ModelState.IsValid) { siteMaster.ModifyAtSite = DateTime.Now; siteMaster.CreatedAtSite = DateTime.Now; _db.Add(siteMaster); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(siteMaster)); }
public async Task <IActionResult> Create(PeriodTbl period) { if (ModelState.IsValid) { period.CreatedAtPeriod = DateTime.Now; period.ModifyAtPeriod = DateTime.Now; _db.Add(period); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(period)); }
public async Task <IActionResult> Create([Bind("TechnicianId,TechnicianName,CreatedAtTech,ModifyAtTech")] TechnicianTbl technicianTbl) { if (ModelState.IsValid) { technicianTbl.CreatedAtTech = DateTime.Now; technicianTbl.ModifyAtTech = DateTime.Now; _context.Add(technicianTbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(technicianTbl)); }
public async Task <IActionResult> Create(ScheduleMaintenanceTbl scheduleMaintenanceTbl) { var assetnamess = _context.AssetTbl.Where(x => x.AssetId == scheduleMaintenanceTbl.AssetId).First().AssetName; var period = _context.PeriodTbl.Where(x => x.PeriodId == scheduleMaintenanceTbl.PeriodId).First().Days; if (ModelState.IsValid) { scheduleMaintenanceTbl.LastMaintenance = DateTime.Now; scheduleMaintenanceTbl.AssetName = assetnamess; scheduleMaintenanceTbl.NextMaintenance = DateTime.Now.AddDays((double)period); //if(scheduleMaintenanceTbl.) //{ //} // scheduleMaintenanceTbl.LastEditedBy = DateTime.Now; _context.Add(scheduleMaintenanceTbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(scheduleMaintenanceTbl)); }
public async Task <IActionResult> Create([Bind("EntityId,SiteId,EntityCode,EntityName,CompanyName,Address,Contact,Pic,CreatedAtEntity,ModifyAtEntity,CreatedBy,ModifyBy")] EntityTbl entityTbl) { if (ModelState.IsValid) { String idrunning = ""; idrunning = generateRunningNumber(idrunning); entityTbl.EntityCode = idrunning; _context.Add(entityTbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(entityTbl)); }
public async Task <IActionResult> Create(AssetGroupTbl assetGroup) { if (ModelState.IsValid) { String idrunning = ""; idrunning = generateRunningNumber(idrunning); assetGroup.AssetGroupCode = idrunning; assetGroup.CreatedAtAssetGroup = DateTime.Now; assetGroup.ModifyAtAssetGroup = DateTime.Now; _db.Add(assetGroup); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(assetGroup)); }
public async Task <IActionResult> Create([Bind("AssetId,AssetGroupId,SiteId,EntityId,AssetCode,AssetName,SerialNumber,ValidityDate,Location,Valuation,CreatedAtAsset,ModifyAtAsset")] AssetTbl assetTbl) { if (ModelState.IsValid) { String idrunning = ""; idrunning = generateRunningNumber(idrunning); assetTbl.AssetCode = idrunning; assetTbl.CreatedAtAsset = DateTime.Now; assetTbl.ModifyAtAsset = DateTime.Now; _context.Add(assetTbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(assetTbl)); }
public async Task <IActionResult> Create(SiteMasterTbl siteMaster) { if (ModelState.IsValid) { String idrunning = ""; idrunning = generateRunningNumber(idrunning); siteMaster.SiteCode = idrunning; siteMaster.ModifyAtSite = DateTime.Now; siteMaster.CreatedAtSite = DateTime.Now; _db.Add(siteMaster); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(siteMaster)); }
public async Task <IActionResult> Create(SparepartTbl sparepart) { if (ModelState.IsValid) { String idrunning = ""; idrunning = generateRunningNumber(idrunning); sparepart.SparepartCode = idrunning; sparepart.CreatedAtSupp = DateTime.Now; sparepart.ModifyAtSupp = DateTime.Now; _db.Add(sparepart); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(sparepart)); }
public async Task <IActionResult> Create([Bind("SupplierId,SupplierCode,Description,Address,Contact,ProductData,CreatedAtSupplier,ModifyAtSupplier")] SupplierTbl supplierTbl) { if (ModelState.IsValid) { String idrunning = ""; idrunning = generateRunningNumber(idrunning); supplierTbl.SupplierCode = idrunning; supplierTbl.CreatedAtSupplier = DateTime.Now; supplierTbl.ModifyAtSupplier = DateTime.Now; _context.Add(supplierTbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(supplierTbl)); }