public async Task <IActionResult> Edit(long id, [Bind("Id,RequestId,RequestDesc,SiteId,LocationId,AssetId,AssetDesc,Date")] WoRequestTbl woRequestTbl) { if (id != woRequestTbl.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(woRequestTbl); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WoRequestTblExists(woRequestTbl.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(woRequestTbl)); }
public async Task <IActionResult> Edit(long id, WorkOrderTbl workOrder) { if (id != workOrder.WoId) { return(NotFound()); } //var a = Convert.ToBoolean(workOrder.SparepartActive); //var b = ""; //if (a == true) //{ // b = "Active"; //} //else //{ // b = "Non Active"; //} if (ModelState.IsValid) { // var checkmainid = _db.WorkOrderTbl.Where(x => x.WoId == id).First(); workOrder.MaentenanceId = _db.WorkOrderTbl.AsNoTracking().Where(x => x.WoId == id).First().MaentenanceId; workOrder.RequestId = _db.WorkOrderTbl.AsNoTracking().Where(x => x.WoId == id).First().RequestId; //workOrder.SparepartActive = b; //_db.Add(workOrder); //await _db.SaveChangesAsync(); _db.Update(workOrder); _db.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(workOrder)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,Availability,SparepartRequestId,WoId,WoDesc,Date,Status,SiteId,Qty,Notes")] SparepartRequestTbl sparepartRequestTbl) { if (id != sparepartRequestTbl.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sparepartRequestTbl); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SparepartRequestTblExists(sparepartRequestTbl.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(sparepartRequestTbl)); }
public async Task <IActionResult> Edit(long id, [Bind("EntityId,SiteId,EntityCode,EntityName,CompanyName,Address,Contact,Pic,CreatedAtEntity,ModifyAtEntity,CreatedBy,ModifyBy")] EntityTbl entityTbl) { if (id != entityTbl.EntityId) { return(NotFound()); } if (ModelState.IsValid) { try { entityTbl.ModifyAtEntity = DateTime.Now; _context.Update(entityTbl); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EntityTblExists(entityTbl.EntityId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(entityTbl)); }
public async Task <IActionResult> Edit(long id, [Bind("AssetId,AssetGroupId,SiteId,EntityId,AssetCode,AssetName,SerialNumber,ValidityDate,Location,Valuation,CreatedAtAsset,ModifyAtAsset")] AssetTbl assetTbl) { if (ModelState.IsValid) { try { assetTbl.ModifyAtAsset = DateTime.Now; _context.Update(assetTbl); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssetTblExists(assetTbl.AssetId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(assetTbl)); }
public async Task <IActionResult> Edit(long id, [Bind("TechnicianId,TechnicianName,CreatedAtTech,ModifyAtTech")] TechnicianTbl technicianTbl) { if (ModelState.IsValid) { try { technicianTbl.TechnicianId = id; technicianTbl.ModifyAtTech = DateTime.Now; _context.Update(technicianTbl); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TechnicianTblExists(technicianTbl.TechnicianId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(technicianTbl)); }
public async Task <IActionResult> Run(long id, WoExeAndWoExeTask woexe) { if (id != woexe.WoExecution.Id) { return(NotFound()); } if (ModelState.IsValid) { woexe.WoExecution.Status = "Complete"; _db.Update(woexe.WoExecution); _db.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(woexe)); }
public async Task <IActionResult> Edit(long id, ScheduleMaintenanceTbl scheduleMaintenanceTbl) { scheduleMaintenanceTbl.ScheduleMainId = id; //if (id != scheduleMaintenanceTbl.ScheduleMainId) //{ // return NotFound(); //} if (ModelState.IsValid) { scheduleMaintenanceTbl.AssetName = scheduleMaintenanceTbl.AssetName; _context.Update(scheduleMaintenanceTbl); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(scheduleMaintenanceTbl)); }
public async Task <IActionResult> Edit(int id, AssetGroupTbl assetGroup) { if (id != assetGroup.AssetGroupId) { return(NotFound()); } if (ModelState.IsValid) { assetGroup.ModifyAtAssetGroup = DateTime.Now; _db.Update(assetGroup); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(assetGroup)); }
public async Task <IActionResult> Edit(long id, PeriodTbl period) { // var create = _db.SiteMasterTbl.Where(m => m.SiteId == siteMaster.SiteId).First().CreatedAtSite; if (id != period.PeriodId) { return(NotFound()); } if (ModelState.IsValid) { // //siteMaster.CreatedAtSite = create; period.ModifyAtPeriod = DateTime.Now; _db.Update(period); _db.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(period)); }
public async Task <IActionResult> Edit(long id, SparepartTbl sparepart) { // var create = _db.SiteMasterTbl.Where(m => m.SiteId == siteMaster.SiteId).First().CreatedAtSite; if (id != sparepart.SparepartId) { return(NotFound()); } if (ModelState.IsValid) { // //siteMaster.CreatedAtSite = create; sparepart.ModifyAtSupp = DateTime.Now; _db.Update(sparepart); _db.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(sparepart)); }