public ActionResult Create(AddrBk_InterestedProductSrvcs addrbk_interested_productservices, Guid organizationId, String orgName, bool isOrganization = true) { try { addrbk_interested_productservices.ContactBasis_LCID = Utils.GetLookUpBasisId(isOrganization); addrbk_interested_productservices.CreatedDt = addrbk_interested_productservices.LastUpdatedDt = DateTime.Now; addrbk_interested_productservices.ActiveRec = true; addrbk_interested_productservices.Id = Guid.NewGuid(); if (isOrganization) addrbk_interested_productservices.OrgID = organizationId; else addrbk_interested_productservices.IndivID = organizationId; db.AddrBk_InterestedProductSrvcs.Add(addrbk_interested_productservices); db.SaveChanges(); return RedirectToAction("Index", new { organizationId = organizationId, orgName = orgName, isOrganization = isOrganization }); } catch { ModelState.AddModelError(String.Empty, Utils.errorMsg); } ViewBag.isOrganization = Convert.ToString(isOrganization); ViewBag.orgName = orgName; ViewBag.organizationId = organizationId; ViewBag.MainTitle = Utils.AddrBkOrganizationInterestedProductServices + " / " + orgName; ViewBag.InterestedProdSrvc_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_InterestedProductsServices), "Id", "Title", addrbk_interested_productservices.InterestedProdSrvc_LCID); return PartialView("_Create", addrbk_interested_productservices); }
// // GET: /AddrBkInterestedProductServices/Create public ActionResult Create(Guid organizationId, String orgName, bool isOrganization = true) { ViewBag.isOrganization = Convert.ToString(isOrganization); ViewBag.orgName = orgName; ViewBag.organizationId = organizationId; ViewBag.MainTitle = Utils.AddrBkOrganizationInterestedProductServices + " / " + orgName; ViewBag.InterestedProdSrvc_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_InterestedProductsServices), "Id", "Title"); var addrbk_interested_productservices = new AddrBk_InterestedProductSrvcs(); addrbk_interested_productservices.EffDt = DateTime.Now; return PartialView("_Create", addrbk_interested_productservices); }
public ActionResult Edit(AddrBk_InterestedProductSrvcs addrbk_interested_productservices, Guid organizationId, String orgName, bool isOrganization = true) { try { addrbk_interested_productservices.LastUpdatedDt = DateTime.Now; db.Entry(addrbk_interested_productservices).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index", new { organizationId = organizationId, orgName = orgName, isOrganization = isOrganization }); } catch (DbUpdateConcurrencyException ex) { var entry = ex.Entries.Single(); var databaseValues = (AddrBk_InterestedProductSrvcs)entry.GetDatabaseValues().ToObject(); ModelState.AddModelError(string.Empty, Utils.concurrencyMsg); addrbk_interested_productservices.Concurrency = databaseValues.Concurrency; } catch { ModelState.AddModelError(String.Empty, Utils.errorMsg); } ViewBag.isOrganization = Convert.ToString(isOrganization); ViewBag.orgName = orgName; ViewBag.organizationId = organizationId; ViewBag.MainTitle = Utils.AddrBkOrganizationInterestedProductServices + " / " + orgName + " / " + Utils.GetInterestedProductServicesTitleFromId(addrbk_interested_productservices.InterestedProdSrvc_LCID); ViewBag.InterestedProdSrvc_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_InterestedProductsServices), "Id", "Title", addrbk_interested_productservices.InterestedProdSrvc_LCID); return PartialView("_Edit", addrbk_interested_productservices); }