public ActionResult Create(int id) { var obj = new ClaimLabourEntity(); obj.ClaimId = id; ViewData.Model = obj; return View(); }
public void Save(ClaimLabourEntity obj) { using (var db = CreateCatalog()) { var claimObj = db.Claims.GetById(obj.ClaimId); obj.ItemAmount = Math.Round(obj.Hours * claimObj.LabourRateAmount, 2); db.ClaimLabour.Save(obj); } }
public ActionResult Create(int id, FormCollection form) { var labourSvc = new LabourLogic(Ticket); var labourId = StringUtility.ToInt(form["labourId"]); var labourObj = labourSvc.GetById(labourId); var obj = new ClaimLabourEntity(); obj.ClaimId = id; if (labourObj != null) { obj.Labour.Id = labourObj.Id; obj.Labour.Code = labourObj.Code; obj.Labour.Name = labourObj.Name; } obj.Hours = decimal.Parse(form["hours"]); ViewData.Model = obj; return View(); }