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