/// <summary> /// Insert/Update Series Picklist /// </summary> /// <param name="se"></param> /// <returns></returns> public async Task <bool> SeriesUpdateAsync(PicklistSeries se) { bool result = true; using (_context) { try { var model = await _context.PicklistSeries.FirstOrDefaultAsync(p => p.SeriesID == se.SeriesID); if (model == null) { _context.PicklistSeries.Add(se); } else { _context.PicklistSeries.Update(se); } await _context.SaveChangesAsync(); } catch (Exception) { result = false; } } return(result); }
public async Task <ActionResult <PicklistSeries> > PostSeries([FromBody] SimpleModel list) { PicklistSeries model = Newtonsoft.Json.JsonConvert.DeserializeObject <PicklistSeries>(list.Name); var response = this.StatusCode((int)HttpStatusCode.OK, await _service.SeriesUpdateAsync(model)); _service.Dispose(); return(response); }