public ActionResult New(PartnershipViewModel model)
 {
     if (ModelState.IsValid)
     {
         var p = new Zakar.Models.Partnership
         {
             Amount = model.Amount,
             CurrencyId = model.CurrencyId,
             DateCreated = DateTime.Now,
             Month = model.Month,
             PartnerId = model.PartnerId,
             PartnershipArmId = model.PartnershipArmId,
             Source = "WEB",
             Year = model.Year
         };
         _partnershipService.Create(p);
         AccessContext.FlushChanges();
         p.TrackingId = "PO-" + p.Id.ToString();
         TempData["Message"] = "Partnership Record Logged Successfully";
         return RedirectToAction("New");
     }
     return View(model);
 }
 public ActionResult StageCreate(int id)
 {
     var s = _stagedPartnershipService.GetSingle(id);
     if (s != null)
     {
         var p = new PartnershipViewModel
         {
             Amount = s.Amount.Round(),
             CurrencyId = s.CurrencyId.HasValue ? s.CurrencyId.Value : 0,
             Month = s.Month.HasValue ? s.Month.Value : 0,
             PartnerId = s.PartnerId.HasValue ? s.PartnerId.Value : 0,
             PartnershipArmId = s.ArmId.HasValue ? s.ArmId.Value : 0,
             Year = s.Year.HasValue ? s.Year.Value : DateTime.Now.Year,
             Id = s.Id
         };
         return PartialView(p);
     }
     return PartialView();
 }
 public ActionResult StageCreate(PartnershipViewModel model)
 {
     if (ModelState.IsValid)
     {
         var p = new Zakar.Models.Partnership
         {
             Amount = model.Amount,
             CurrencyId = model.CurrencyId,
             DateCreated = DateTime.Now,
             Month = model.Month,
             PartnerId = model.PartnerId,
             PartnershipArmId = model.PartnershipArmId,
             Source = "WEB",
             Year = model.Year
         };
         _partnershipService.Create(p);
         AccessContext.FlushChanges();
         p.TrackingId = "PO-" + p.Id.ToString(CultureInfo.InvariantCulture);
         _stagedPartnershipService.Delete(model.Id);
         TempData["Message"] = "Partnership Record Logged Successfully";
         return Json(new {});
     }
     return PartialView(model);
 }
 public ActionResult Edit(PartnershipViewModel model)
 {
     if (ModelState.IsValid)
     {
         var p = _partnershipService.GetSingle(model.Id);
         if (p != null)
         {
             p.Amount = model.Amount;
             p.CurrencyId = model.CurrencyId;
             p.Month = model.Month;
             p.PartnerId = model.PartnerId;
             p.PartnershipArmId = model.PartnershipArmId;
             p.Year = model.Year;
             return Json(new {});
         }
         ModelState.AddModelError("","Cannot update a non-existent entity");
     }
     return PartialView(model);
 }