コード例 #1
0
        private async void OnAddMember(object obj)
        {
            if (CanAdd(obj) == false)
            {
                return;
            }

            IsBusyBindProp = true;

            // Thuc hien cong viec tai day

            var member = new Member
            {
                Id       = Guid.NewGuid().ToString(),
                Name     = NameMemberBindProp,
                NumPhone = PhoneNumberMemberBindProp,
                Gender   = GenderMemberBindProp,
                Email    = EmailBindProp,
                FkRole   = "R03"
            };

            try
            {
                if (ModeNewBindProp)
                {
                    var createMember = await logic.CreateMember(member);

                    var param = new NavigationParameters();
                    param.Add(Param.PARAM_TITLE, TitleBindProp);
                    param.Add(Param.PARAM_ADD_MEMBER, createMember);
                    await NavigationService.NavigateAsync(nameof(VBS_MemberPage), param);
                }
                else
                {
                    var editMember = await logic.EditMember(ModelBindProp);

                    editMember.RaisePropertyChange(nameof(Member.NumPhone));
                    editMember.RaisePropertyChange(nameof(Member.Name));
                    editMember.RaisePropertyChange(nameof(Member.Email));
                    await NavigationService.GoBackAsync();
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                IsBusyBindProp = false;
            }
        }