示例#1
0
        public ActionResult Create(Addrbk_Hobby addrbk_hobby, Guid organizationId, String orgName)
        {
            try
            {
                addrbk_hobby.Id = Guid.NewGuid();
                addrbk_hobby.CreatedDt = addrbk_hobby.LastUpdatedDt = DateTime.Now;
                addrbk_hobby.ActiveRec = true;
                addrbk_hobby.IndivID = organizationId;

                db.Addrbk_Hobby.Add(addrbk_hobby);
                db.SaveChanges();

                return RedirectToAction("Index", new { organizationId = organizationId, orgName = orgName });
            }
            catch
            {
                ModelState.AddModelError(String.Empty, Utils.errorMsg);
            }

            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkHobby + " / " + orgName;
            ViewBag.Hobby_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_Hobby), "Id", "Title", addrbk_hobby.Hobby_LCID);
            return PartialView("_Create", addrbk_hobby);
        }
示例#2
0
        //
        // GET: /AddrBkHobby/Create
        public ActionResult Create(Guid organizationId, String orgName)
        {
            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkHobby + " / " + orgName;
            ViewBag.Hobby_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_Hobby), "Id", "Title");

            Addrbk_Hobby addrbk_hobby = new Addrbk_Hobby();
            addrbk_hobby.EffDt = DateTime.Now;
            return PartialView("_Create", addrbk_hobby);
        }
示例#3
0
        public ActionResult Edit(Addrbk_Hobby addrbk_hobby, Guid organizationId, String orgName)
        {
            try
            {
                addrbk_hobby.LastUpdatedDt = DateTime.Now;
                db.Entry(addrbk_hobby).State = EntityState.Modified;
                db.SaveChanges();

                return RedirectToAction("Index", new { organizationId = organizationId, orgName = orgName });
            }
            catch (DbUpdateConcurrencyException ex)
            {
                var entry = ex.Entries.Single();
                var databaseValues = (Addrbk_Hobby)entry.GetDatabaseValues().ToObject();
                ModelState.AddModelError(string.Empty, Utils.concurrencyMsg);
                addrbk_hobby.Concurrency = databaseValues.Concurrency;
            }
            catch
            {
                ModelState.AddModelError(String.Empty, Utils.errorMsg);
            }

            ViewBag.orgName = orgName;
            ViewBag.organizationId = organizationId;
            ViewBag.MainTitle = Utils.AddrBkHobby + " / " + orgName + " / " + Utils.GetHobbyFromId(addrbk_hobby.Hobby_LCID);
            ViewBag.Hobby_LCID = new SelectList(db.Lookup_AddrBk.Where(a => a.ActiveRec == true && a.TblColSel == Utils.AB_Hobby), "Id", "Title", addrbk_hobby.Hobby_LCID);
            return PartialView("_Edit", addrbk_hobby);
        }