public ActionResult PaymentAction(int?id) { ViewBag.drpPaymentStatus = CommonController.drpPaymentStatus(); ViewBag.drpEnrollment = CommonController.drpEnrollment(); if (id != 0) { Payment dataset = entities.Payments.Find(id); return(PartialView(dataset)); } else { return(PartialView()); } }
public ActionResult HireAction(int?id) { ViewBag.drpAssert = CommonController.drpAssert(); ViewBag.drpEnrollment = CommonController.drpEnrollment(); if (id != 0) { InstrumentHire dataset = entities.InstrumentHires.Find(id); return(PartialView(dataset)); } else { return(PartialView()); } }
public ActionResult HireAction(InstrumentHire instrumenthire) { ModelState.Remove("InstrumentHireId"); if (ModelState.IsValid) { string msg = ""; if (instrumenthire.InstrumentHireId > 0) { var dataset = entities.InstrumentHires.Where(f => f.InstrumentHireId == instrumenthire.InstrumentHireId).FirstOrDefault(); if (dataset != null) { dataset.Description = instrumenthire.Description; dataset.InstrumentAssertID = instrumenthire.InstrumentAssertID; dataset.EnrolmentID = instrumenthire.EnrolmentID; dataset.InstrumentAssert.InstrumentConditionID = 3; msg = "Hire details Updated Successfully"; } } else { entities.InstrumentHires.Add(instrumenthire); InstrumentAssert datasetassert = entities.InstrumentAsserts.Where(f => f.InstrumentAssertID == instrumenthire.InstrumentAssertID).FirstOrDefault(); datasetassert.InstrumentConditionID = 3; msg = "New Hire details Added successfully"; } entities.SaveChanges(); return(new JsonResult { Data = new { success = true, action = "Hire", message = msg }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } ViewBag.drpAssert = CommonController.drpAssert(); ViewBag.drpEnrollment = CommonController.drpEnrollment(); return(PartialView(instrumenthire)); }
public ActionResult PaymentAction(Payment payment) { ModelState.Remove("PaymentID"); if (ModelState.IsValid) { string msg = ""; if (payment.PaymentID > 0) { var dataset = entities.Payments.Where(f => f.PaymentID == payment.PaymentID).FirstOrDefault(); if (dataset != null) { dataset.PayableAmount = payment.PayableAmount; dataset.PaidAMount = payment.PaidAMount; dataset.Comments = payment.Comments; dataset.EnrolmentID = payment.EnrolmentID; dataset.PaymentStatus = payment.PaymentStatus; msg = "Payment details Updated Successfully"; } } else { entities.Payments.Add(payment); msg = "New Payment Added successfully"; } entities.SaveChanges(); return(new JsonResult { Data = new { success = true, action = "Payment", message = msg }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } ViewBag.drpPaymentStatus = CommonController.drpPaymentStatus(); ViewBag.drpEnrollment = CommonController.drpEnrollment(); return(PartialView(payment)); }