public ActionResult Create(int orgID)
        {
            try
            {
                OrganisationContactModel editModel = new OrganisationContactModel();
                sw.Organisation          member    = swdb.Organisation.Where(x => x.Id == orgID).FirstOrDefault();

                if (member == null)
                {
                    return(HttpNotFound());
                }

                sw.ContactInfo memberBeneficiary = new sw.ContactInfo()
                {
                    OrgID = member.Id
                };
                editModel.org         = member;
                editModel.contactInfo = memberBeneficiary;
                //editModel.addressType = new SelectList(swdb.AddressType, "ID", "Name").ToList();

                return(View(editModel));
            }
            catch (Exception ex)
            {
                // Log with Elmah
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                TempData["message"] = Settings.Default.GenericExceptionMessage;
                return(RedirectToAction("Index", new { orgID = orgID }));
            }
        }
        public ActionResult Edit(int ID)
        {
            try
            {
                OrganisationContactModel editModel         = new OrganisationContactModel();
                sw.ContactInfo           memberBeneficiary = swdb.ContactInfo.Where(x => x.Id == ID).FirstOrDefault();

                if (memberBeneficiary == null)
                {
                    return(HttpNotFound());
                }

                sw.Organisation member = swdb.Organisation.Where(x => x.Id == memberBeneficiary.OrgID).FirstOrDefault();

                editModel.org         = member;
                editModel.contactInfo = memberBeneficiary;

                return(View(editModel));
            }
            catch (Exception ex)
            {
                // Log with Elmah
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                TempData["message"] = Settings.Default.GenericExceptionMessage;
                return(RedirectToAction("Index", "Home", new { area = "Admin" }));
            }
        }
        public ActionResult Edit(OrganisationContactModel editModel)
        {
            sw.ContactInfo memberBeneficiary = editModel.contactInfo;
            try
            {
                if (ModelState.IsValid)
                {
                    memberBeneficiary.ModifiedBy   = User.Identity.Name;
                    memberBeneficiary.ModifiedDate = DateTime.Now;

                    swdb.ContactInfo.Attach(memberBeneficiary);
                    swdb.Entry(memberBeneficiary).State = EntityState.Modified;
                    //swdb.ObjectStateManager.ChangeObjectState(memberBeneficiary, EntityState.Modified);


                    swdb.SaveChanges();
                    TempData["message"] = "<b>" + memberBeneficiary.FirstName + "</b> was Successfully Updated";
                    return(RedirectToAction("Index", new { orgID = memberBeneficiary.OrgID }));
                }

                //  editModel.addressType = new SelectList(swdb.AddressType, "ID", "Name", memberBeneficiary.AddressTypeId).ToList();

                return(View(editModel));
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                TempData["message"] = Settings.Default.GenericExceptionMessage;
                return(RedirectToAction("Index", new { orgID = memberBeneficiary.OrgID }));
            }
        }
        public ActionResult Create(OrganisationContactModel editModel)
        {
            sw.ContactInfo memberBeneficiary = editModel.contactInfo;
            try
            {
                if (ModelState.IsValid)
                {
                    memberBeneficiary.ModifiedBy   = User.Identity.Name;
                    memberBeneficiary.ModifiedDate = DateTime.Now;
                    swdb.ContactInfo.Add(memberBeneficiary);

                    swdb.SaveChanges();
                    TempData["message"] = "<b>" + memberBeneficiary.FirstName + "</b> was Successfully Saved";
                    return(RedirectToAction("Index", new { orgID = memberBeneficiary.OrgID }));
                }
                sw.Organisation member = swdb.Organisation.Where(x => x.Id == editModel.contactInfo.OrgID).FirstOrDefault();
                editModel.org = member;
                //editModel.addressType = new SelectList(swdb.AddressType, "ID", "Name").ToList();
                return(View(editModel));
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                TempData["message"] = Settings.Default.GenericExceptionMessage;
                return(RedirectToAction("Index", new { orgID = memberBeneficiary.OrgID }));
            }
        }