public JsonResult AddRepairDevice(int Iddv, int user, string Notesrepair) { if (user == 0) { data.AddRepairDetails(Iddv, DateTime.Now, null, null, null, null, null, Notesrepair); } else { data.AddRepairDetails(Iddv, DateTime.Now, null, null, null, null, user, Notesrepair); } bool result = true; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult AddRepairDetails(FormCollection colection, RepairDetail RepairDetail) { int? DeviceId = colection["DeviceId"].Equals("") ? (int?)null : Convert.ToInt32(colection["DeviceId"]); DateTime?DateOfRepair = colection["DateOfRepair"].Equals("") ? (DateTime?)null : Convert.ToDateTime(colection["DateOfRepair"]); string AddressOfRepair = colection["AddressOfRepair"]; int? TimeOrder = colection["TimeOrder"].Equals("") ? (int?)null : Convert.ToInt32(colection["TimeOrder"]); int? TypeOfRepair = colection["TypeOfRepair"].Equals("0") ? (int?)null : Convert.ToInt32(colection["TypeOfRepair"]); int? UserId = colection["UserId"].Equals("") ? (int?)null : Convert.ToInt32(colection["UserId"]); string Notes = colection["Notes"]; DateTime?NextDateOfRepair = colection["NextDateOfRepair"].Equals("") ? (DateTime?)null : Convert.ToDateTime(colection["NextDateOfRepair"]); Ql.AddRepairDetails(DeviceId, DateOfRepair, NextDateOfRepair, TimeOrder, TypeOfRepair, AddressOfRepair, UserId, Notes); return(RedirectToAction("RepairDetails", "RepairDetails")); }