public async Task <IActionResult> PutRpegrade([FromRoute] int id, [FromBody] Rpegrade rpegrade)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != rpegrade.Rpeid)
            {
                return(BadRequest());
            }

            try
            {
                await rpegradeService.Update(id, rpegrade);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RpegradeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PostRpegrade([FromBody] Rpegrade rpegrade)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entity = await rpegradeService.Insert(rpegrade);

            if (entity == null)
            {
                return(BadRequest());
            }
            return(CreatedAtAction("GetRpegradeByID", new { id = rpegrade.Rpeid }, rpegrade));
        }
        public async Task <Rpegrade> Insert(Rpegrade tblRpegrade)
        {
            try
            {
                tblRpegrade.CreatedDate = DateTime.Now;
                context.Add(tblRpegrade);
                await context.SaveChangesAsync();

                return(tblRpegrade);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public async Task Update(int Id, Rpegrade tblRpegrade)
 {
     try
     {
         if (tblRpegrade == null)
         {
             throw new ArgumentNullException(nameof(tblRpegrade));
         }
         if (Id != tblRpegrade.Rpeid)
         {
             throw new NotImplementedException();
         }
         tblRpegrade.ModifiedDate = DateTime.Now;
         context.TblRpegrade.Update(tblRpegrade);
         await context.SaveChangesAsync();
     }
     catch (Exception)
     {
         throw;
     }
 }