//
        // GET: /AddrBkGeographicalGroup/Create
        public ActionResult Create()
        {
            ViewBag.MainTitle = Utils.AddressBook + " / " + Utils.AddrbkGeographicalGroup;
            ViewBag.GeoBasis_LCID = new SelectList(db.Lookup_GeographicalBasis.Where(a=>a.ActiveRec == true), "Id", "Title");

            var addrbk_geographicalgroup = new AddrBk_GeographicalGroup();
            addrbk_geographicalgroup.EffDt = DateTime.Now;

            return View(addrbk_geographicalgroup);
        }
        public ActionResult Create(AddrBk_GeographicalGroup addrbk_geographicalgroup)
        {
            if (ModelState.IsValid)
            {
                addrbk_geographicalgroup.Id = Guid.NewGuid();
                addrbk_geographicalgroup.CreatedDt = addrbk_geographicalgroup.LastUpdatedDt = DateTime.Now;
                addrbk_geographicalgroup.ActiveRec = true;
                db.AddrBk_GeographicalGroup.Add(addrbk_geographicalgroup);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.MainTitle = Utils.AddressBook + " / " + Utils.AddrbkGeographicalGroup;
            ViewBag.GeoBasis_LCID = new SelectList(db.Lookup_GeographicalBasis.Where(a=>a.ActiveRec == true), "Id", "Title", addrbk_geographicalgroup.GeoBasis_LCID);
            return View(addrbk_geographicalgroup);
        }
        public ActionResult Edit(AddrBk_GeographicalGroup addrbk_geographicalgroup)
        {
            try
            {
                addrbk_geographicalgroup.LastUpdatedDt = DateTime.Now;
                db.Entry(addrbk_geographicalgroup).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            catch (DbUpdateConcurrencyException ex)
            {
                var entry = ex.Entries.Single();
                var databaseValues = (AddrBk_GeographicalGroup)entry.GetDatabaseValues().ToObject();
                var clientValues = (AddrBk_GeographicalGroup)entry.Entity;
                ModelState.AddModelError(string.Empty, Utils.concurrencyMsg);
                addrbk_geographicalgroup.Concurrency = databaseValues.Concurrency;
            }
            catch (Exception)
            {
                ModelState.AddModelError(string.Empty, Utils.errorMsg);

            }

            ViewBag.GeoBasis_LCID = new SelectList(db.Lookup_GeographicalBasis.Where(a=>a.ActiveRec == true), "Id", "Title", addrbk_geographicalgroup.GeoBasis_LCID);
            return View(addrbk_geographicalgroup);
        }