public ActionResult Create(int id, FormCollection form) { var claimPartSvc = new ClaimPartLogic(Ticket); var partSvc = new PartLogic(Ticket); var partTypeSvc = new PartTypeLogic(Ticket); var partId = StringUtility.ToInt(form["partId"]); var partTypeId = StringUtility.ToInt(form["partTypeId"]); var partObj = partSvc.GetById(partId); var partTypeObj = partTypeSvc.GetById(partTypeId); var obj = new ClaimPartEntity(); obj.ClaimId = id; if (partObj != null) { obj.Part.Id = partObj.Id; obj.Part.Code = partObj.Code; obj.Part.Name = partObj.Name; } if (partTypeObj != null) { obj.PartType.Id = partTypeObj.Id; obj.PartType.Code = partTypeObj.Code; obj.PartType.Name = partTypeObj.Name; } obj.ReferenceNumber = form["referenceNumber"]; obj.PurchaseDate = StringUtility.ToDateTime(form["purchaseDate"]); obj.Quantity = StringUtility.ToDecimal(form["quantity"]); claimPartSvc.Save(obj); return RedirectToAction("Display", "WarrantyClaim", new { id = obj.ClaimId }); }
private SelectList BuildPartTypeList(int partTypeId) { var partTypeSvc = new PartTypeLogic(Ticket); var partTypeList = partTypeSvc.GetAll(); return new SelectList(partTypeList, "Id", "Name", partTypeId); }