public ActionResult MemberRelations(UserFamilyModel relations)
        {
            UserMembersServiceClient client = new UserMembersServiceClient();

            RelationsModel[] rmodel      = relations.RelationsList.ToArray();
            RelationsData[]  relatnsData = new RelationsData[rmodel.Length];
            for (int i = 0; i < rmodel.Length; i++)
            {
                relatnsData[i] = new RelationsData
                {
                    RelativeId          = rmodel[i].RelativeId,
                    RelativeName        = rmodel[i].RelativeName,
                    RelationType        = rmodel[i].RelationType,
                    ReverseRelationType = rmodel[i].ReverseRelationType
                };
            }
            var responseFromClient = client.AddMember(MemberData(relations, relatnsData));

            if (responseFromClient.Message == "Success")
            {
                TempData["NewApplication"] = relations.UserId;
                return(RedirectToAction("index", "UserApplication"));
            }


            else
            {
                return(View());
            }
        }
 private static UserMembersData MemberData(UserFamilyModel relations, RelationsData[] relatnsData)
 {
     return(new UserMembersData()
     {
         FirstName = relations.FirstName,
         MiddleName = relations.MiddleName,
         LastName = relations.LastName,
         Suffix = relations.Suffix,
         Gender = relations.Gender,
         Dob = relations.Dob,
         Email = relations.Email,
         UserId = relations.UserId,
         MemberId = relations.MemberId,
         RelationsList = relatnsData
     });
 }
Exemplo n.º 3
0
        public ActionResult StoreNewApplication(UserFamilyModel member)
        {
            if (ModelState.IsValid)
            {
                member.MemberId = new Random().Next(10000);
                if (Session["NewMembers"] != null)
                {
                    listOfmembers = (List <UserFamilyModel>)System.Web.HttpContext.Current.Session["NewMembers"];
                    listOfmembers.Add(member);
                }
                else
                {
                    listOfmembers.Add(member);
                }
                System.Web.HttpContext.Current.Session["NewMembers"] = listOfmembers;
                ViewBag.StatusMessage    = listOfmembers.Count + " Member(s) added";
                ViewBag.DisplayStatusMsg = "block";
                member = new UserFamilyModel();
                return(View("index", member));
            }

            return(View("index", member));
        }