public DtoTblSection(TblSection section, HttpStatusCode statusEffect) { id = section.id; SectionName = section.SectionName; StatusEffect = statusEffect; }
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); }
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); }
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)); }
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)); }
public bool UpdateSection(TblSection section, int logId) { return(new MainProvider().Update(section, logId)); }
public TblSection AddSection(TblSection section) { return((TblSection) new MainProvider().Add(section)); }
public IActionResult Put(string id, [FromBody] TblSection uSection) { return(new JsonResult(this.repository.UpdateAsync(uSection, id).Result, this.DefaultJsonSettings)); }
public IActionResult Post([FromBody] TblSection nSection) { return(new JsonResult(this.repository.AddAsync(nSection).Result, this.DefaultJsonSettings)); }
public TblSection AddSection(TblSection section) { return(new SectionRepo().AddSection(section)); }
public bool UpdateSection(TblSection section, int logId) { return(new SectionRepo().UpdateSection(section, logId)); }