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