public ActionResult Create([Bind(Include = "id,tPIAllocationId,date,reportingQC,plant,productGroup,inTime,offeringTime,outTime,idleTime,days,totalQTYoffered,noofOkCasting,ftp,stp,rw,hold,rejected,scopeInspection,status")] TPICall tPICall) { if (ModelState.IsValid) { var enAllocation = db.TPIAllocations.FirstOrDefault(x => x.id == tPICall.tPIAllocationId); if (enAllocation != null) { if (enAllocation.start == null && enAllocation.status == "New") { enAllocation.start = DateTime.Now; enAllocation.status = "InProgress"; tPICall.createdAt = DateTime.Now; db.TPICalls.Add(tPICall); db.SaveChanges(); } } return(RedirectToAction("Index")); } var tpiallocation = db.TPIAllocations.Where(f => f.employeeId == Custom.Display.UserId && f.status != "Completed").Select(x => new { id = x.id, title = x.title + "-" + x.Company.companyName }); ViewBag.tPIAllocationId = new SelectList(tpiallocation, "id", "title", tPICall.tPIAllocationId); return(View(tPICall)); }
public ActionResult DeleteConfirmed(int id) { TPICall tPICall = db.TPICalls.Find(id); db.TPICalls.Remove(tPICall); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: TPICalls/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TPICall tPICall = db.TPICalls.Find(id); if (tPICall == null) { return(HttpNotFound()); } return(View(tPICall)); }
public ActionResult Edit([Bind(Include = "id,tPIAllocationId,date,reportingQC,plant,productGroup,inTime,offeringTime,outTime,idleTime,days,totalQTYoffered,noofOkCasting,ftp,stp,rw,hold,rejected,scopeInspection,status")] TPICall tPICall) { if (ModelState.IsValid) { tPICall.modifiedAt = DateTime.Now; db.Entry(tPICall).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } var tpiallocation = db.TPIAllocations.Where(f => f.employeeId == Custom.Display.UserId && f.status != "Completed").Select(x => new { id = x.id, title = x.title + "-" + x.Company.companyName }); ViewBag.tPIAllocationId = new SelectList(tpiallocation, "id", "title", tPICall.tPIAllocationId); return(View(tPICall)); }
// GET: TPICalls/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TPICall tPICall = db.TPICalls.Find(id); if (tPICall == null) { return(HttpNotFound()); } var tpiallocation = db.TPIAllocations.Where(f => f.employeeId == Custom.Display.UserId && f.status != "Completed").Select(x => new { id = x.id, title = x.title + "-" + x.Company.companyName }); ViewBag.tPIAllocationId = new SelectList(tpiallocation, "id", "title", tPICall.tPIAllocationId); return(View(tPICall)); }
// GET: TPICalls/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TPICall tPICall = db.TPICalls.Find(id); db.TPICalls.Remove(tPICall); db.SaveChanges(); if (tPICall == null) { return(HttpNotFound()); } return(RedirectToAction("Index")); }