Ejemplo n.º 1
0
        public async Task <DepartmentChildren> PutDepartmentChildrenAsync(DepartmentChildren departmentChildren)
        {
            var jObject = JsonConvert.SerializeObject(departmentChildren);

            //Make Json object into content type
            var content = new StringContent(jObject);

            //Adding header of the contenttype
            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            DepartmentChildren responseDepartmentChildren = null;

            try
            {
                var response = await Client.PutAsync(this.BaseUrl + "/api/DepartmentChildrens/" + departmentChildren.Id, content);

                if (response.IsSuccessStatusCode)
                {
                    var responseContent = await response.Content.ReadAsStringAsync();

                    responseDepartmentChildren = JsonConvert.DeserializeObject <DepartmentChildren>(responseContent);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Exception in RestService.PutTagAsync: " + e);
            }
            return(responseDepartmentChildren);
        }
        async void ExecuteDepartmentChildrenDeleteCommand(DepartmentChildren SelectedDepartmentChildren)
        {
            DepartmentChildren deletedDepartmentChildren = await SelectedDepartmentChildren.DeleteDepartmentChildrenAsync(SelectedDepartmentChildren.Id);

            // ユーザ一覧 DepartmentChildrens を更新する。
            this.UpdateDepartmentChildrens();
        }
        public async Task <IActionResult> PutDepartmentChildren(long id, DepartmentChildren departmentChildren)
        {
            if (id != departmentChildren.Id)
            {
                return(BadRequest());
            }

            // Department には既に存在しているユーザが入るため、更新の対象から外す。
            //_context.Departments.Attach(departmentChildren.Department);

            _context.Entry(departmentChildren).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DepartmentChildrenExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 4
0
        public async void OnNavigatedTo(NavigationContext navigationContext)
        {
            DepartmentChildren dept = new DepartmentChildren();

            this.DepartmentChildrens = await dept.GetDepartmentChildrensAsync();

            this.User = new User();
        }
        void ExecuteDepartmentChildrenEditCommand(DepartmentChildren SelectedDepartmentChildren)
        {
            // 対象のDepartmentChildrenをパラメーターとして画面遷移先に渡す。
            var parameters = new NavigationParameters();

            parameters.Add("SelectedDepartmentChildren", SelectedDepartmentChildren);

            this.regionManager.RequestNavigate("ContentRegion", nameof(Views.DepartmentChildrenEdit), parameters);
        }
        public async void OnNavigatedTo(NavigationContext navigationContext)
        {
            // 画面遷移元から送られる SelectedUser パラメーターを取得。
            this.User = navigationContext.Parameters.GetValue <User>("SelectedUser");

            DepartmentChildren dept = new DepartmentChildren();

            this.DepartmentChildrens = await dept.GetDepartmentChildrensAsync();
        }
        public async Task <ActionResult <User> > PostDepartmentChildren(DepartmentChildren departmentChildren)
        {
            // Department には既に存在しているユーザが入るため、更新の対象から外す。
            //_context.Departments.Attach(user.Department);

            _context.DepartmentChildrens.Add(departmentChildren);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDepartmentChildren", new { id = departmentChildren.Id }, departmentChildren));
        }
Ejemplo n.º 8
0
        public async Task <DepartmentChildren> DeleteDepartmentChildrenAsync(long Id)
        {
            DepartmentChildren responseDepartmentChildren = null;

            try
            {
                var response = await Client.DeleteAsync(this.BaseUrl + "/api/DepartmentChildrens/" + Id);

                if (response.IsSuccessStatusCode)
                {
                    var responseContent = await response.Content.ReadAsStringAsync();

                    responseDepartmentChildren = JsonConvert.DeserializeObject <DepartmentChildren>(responseContent);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Exception in RestService.DeleteTagAsync: " + e);
            }
            return(responseDepartmentChildren);
        }
        private async void UpdateDepartmentChildrens()
        {
            DepartmentChildren DC = new DepartmentChildren();

            this.DepartmentChildrens = await DC.GetDepartmentChildrensAsync();
        }
Ejemplo n.º 10
0
 public Task <DepartmentChildren> LogonAsync(DepartmentChildren departmentChildren)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 11
0
        async void ExecuteSubmitCommand()
        {
            DepartmentChildren updatedDepartmentChildren = await DepartmentChildren.PutDepartmentChildrenAsync(this.DepartmentChildren);

            this.regionManager.RequestNavigate("ContentRegion", nameof(Views.DepartmentChildrenMst));
        }