コード例 #1
0
        public DtoTblSection(TblSection section, HttpStatusCode statusEffect)
        {
            id          = section.id;
            SectionName = section.SectionName;

            StatusEffect = statusEffect;
        }
コード例 #2
0
        public async Task <TblSection> AddSection(TblSection section)
        {
            HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync("api/SectionCore/AddSection", section);

            TblSection ans = await httpResponseMessage.Content.ReadAsAsync <TblSection>();

            return(ans);
        }
コード例 #3
0
        public async Task <bool> UpdateSection(TblSection section, int logId)
        {
            List <object> sectionAndLogId = new List <object>();

            sectionAndLogId.Add(section);
            sectionAndLogId.Add(logId);
            HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync("api/SectionCore/UpdateSection", sectionAndLogId);

            bool ans = await httpResponseMessage.Content.ReadAsAsync <bool>();

            return(ans);
        }
コード例 #4
0
        public IHttpActionResult AddSection(TblSection section)
        {
            var task = Task.Run(() => new SectionService().AddSection(section));

            if (task.Wait(TimeSpan.FromSeconds(10)))
            {
                if (task.Result.id != -1)
                {
                    return(Ok(new DtoTblSection(task.Result, HttpStatusCode.OK)));
                }
                else
                {
                    return(Conflict());
                }
            }
            return(StatusCode(HttpStatusCode.RequestTimeout));
        }
コード例 #5
0
        public IHttpActionResult UpdateSection(List <object> sectionLogId)
        {
            TblSection section = JsonConvert.DeserializeObject <TblSection>(sectionLogId[0].ToString());
            int        logId   = JsonConvert.DeserializeObject <int>(sectionLogId[1].ToString());
            var        task    = Task.Run(() => new SectionService().UpdateSection(section, logId));

            if (task.Wait(TimeSpan.FromSeconds(10)))
            {
                if (task.Result)
                {
                    return(Ok(true));
                }
                else
                {
                    return(Conflict());
                }
            }
            return(StatusCode(HttpStatusCode.RequestTimeout));
        }
コード例 #6
0
 public bool UpdateSection(TblSection section, int logId)
 {
     return(new MainProvider().Update(section, logId));
 }
コード例 #7
0
 public TblSection AddSection(TblSection section)
 {
     return((TblSection) new MainProvider().Add(section));
 }
コード例 #8
0
 public IActionResult Put(string id, [FromBody] TblSection uSection)
 {
     return(new JsonResult(this.repository.UpdateAsync(uSection, id).Result, this.DefaultJsonSettings));
 }
コード例 #9
0
 public IActionResult Post([FromBody] TblSection nSection)
 {
     return(new JsonResult(this.repository.AddAsync(nSection).Result, this.DefaultJsonSettings));
 }
コード例 #10
0
 public TblSection AddSection(TblSection section)
 {
     return(new SectionRepo().AddSection(section));
 }
コード例 #11
0
 public bool UpdateSection(TblSection section, int logId)
 {
     return(new SectionRepo().UpdateSection(section, logId));
 }