예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }