public async Task <ApiResponse> GetVesselNameById(TblVesselName VesselName) { var tblVesselName = await _context.TblVesselName.FindAsync(VesselName.Id); var ApiResponse = await response.ApiResult("OK", tblVesselName, "Record Add"); return(ApiResponse); }
public async Task <ApiResponse> AddVesselName(TblVesselName tblVesselName) { _context.TblVesselName.Add(tblVesselName); await _context.SaveChangesAsync(); var ApiResponse = await response.ApiResult("OK", "", "Record Add"); return(ApiResponse); // return CreatedAtAction("GetTblVesselName", new { id = tblVesselName.Id }, tblVesselName); }
public async Task <ApiResponse> UpdateVesselName(long id, TblVesselName tblVesselName) { _context.Entry(tblVesselName).State = EntityState.Modified; try { await _context.SaveChangesAsync(); var ApiResponse = await response.ApiResult("OK", "", "Record Add"); return(ApiResponse); } catch (DbUpdateConcurrencyException ex) { var ApiResponseError = await response.ApiResult("OK", ex, "Record Add"); return(ApiResponseError); } }