コード例 #1
0
        public async Task <IActionResult> PutBusyo(int id, Busyo busyo)
        {
            if (id != busyo.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <Busyo> > PostBusyo(Busyo busyo)
        {
            _context.Busyoes.Add(busyo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBusyo", new { id = busyo.Id }, busyo));
        }
コード例 #3
0
        public async void SubmitB()
        {
            Busyo createdBusyo = await BusyoP.PostBusyoAsync(this.BusyoP);

            //TODO: Error handling
            Messenger.Raise(new WindowActionMessage(WindowAction.Close, "ShowSubmitCommandB"));
        }
コード例 #4
0
        public async Task <Busyo> PutBusyoAsync(Busyo busyo)
        {
            var jObject = JsonConvert.SerializeObject(busyo);

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

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

            Busyo responseUser = null;

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

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

                    responseUser = JsonConvert.DeserializeObject <Busyo>(responseContent);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Exception in RestService.PutBusyoAsync: " + e);
            }
            return(responseUser);
        }
コード例 #5
0
        public async void Initialize()
        {
            Busyo busyo = new Busyo();

            this.Busyo = await busyo.GetBusyoAsync();

            // Ka ka = new Ka();
            // this.Ka = await ka.GetKaAsync();
        }
コード例 #6
0
        public async void BusyoPut(Busyo Busyo)
        {
            System.Diagnostics.Debug.WriteLine("PutCommand" + Busyo.Id);
            BusyoP = Busyo;

            Busyo putBusyo = await Busyo.PutBusyoAsync(this.BusyoP);

            //TODO: Error handling
            Messenger.Raise(new WindowActionMessage(WindowAction.Close, "Put"));
        }
コード例 #7
0
        public async void Initialize()
        {
            Employee employee = new Employee();

            this.Employee = await employee.GetEmployeeAsync();

            this.CEmployee = new Employee();

            Ka ka = new Ka();

            this.Ka = await ka.GetKaAsync();

            Busyo busyo = new Busyo();

            this.Busyo = await busyo.GetBusyoAsync();
        }
コード例 #8
0
        public async Task <Busyo> DeleteBusyoAsync(int Id)
        {
            Busyo responseBusyo = null;

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

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

                    responseBusyo = JsonConvert.DeserializeObject <Busyo>(responseContent);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Exception in RestService.DeleteBusyoAsync: " + e);
            }
            return(responseBusyo);
        }
コード例 #9
0
        public async void Initialize()
        {
            Busyo busyo = new Busyo();

            this.Busyo = await busyo.GetBusyoAsync();
        }
コード例 #10
0
        public async void BusyoDelete(Busyo Busyo)
        {
            Busyo deletedBusyo = await Busyo.DeleteBusyoAsync(Busyo.Id);

            Messenger.Raise(new WindowActionMessage(WindowAction.Close, "ShowBusyoDeleteCommand"));
        }