Beispiel #1
0
        public async Task <IActionResult> UpdateCompletionGrade([FromRoute] int id, [FromBody] CompletionGrade completionGrade)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != completionGrade.CompletionGradeId)
            {
                return(BadRequest());
            }

            try
            {
                await completionGradesService.Update(id, completionGrade);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CompletionGradeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <CompletionGrade> Insert(CompletionGrade tblCompletionGrade)
        {
            try
            {
                tblCompletionGrade.CreatedDate = DateTime.Now;
                context.Add(tblCompletionGrade);
                await context.SaveChangesAsync();

                return(tblCompletionGrade);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #3
0
        public async Task <IActionResult> InsertCompletionGrade([FromBody] CompletionGrade completionGrade)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entity = await completionGradesService.Insert(completionGrade);

            if (entity == null)
            {
                return(BadRequest());
            }
            return(CreatedAtAction("GetCompletionGradeByID", new { id = completionGrade.CompletionGradeId }, completionGrade));
        }
 public async Task Update(int Id, CompletionGrade tblCompletionGrade)
 {
     try
     {
         if (tblCompletionGrade == null)
         {
             throw new ArgumentNullException(nameof(tblCompletionGrade));
         }
         if (Id != tblCompletionGrade.CompletionGradeId)
         {
             throw new NotImplementedException();
         }
         tblCompletionGrade.ModifiedDate = DateTime.Now;
         context.TblCompletionGrade.Update(tblCompletionGrade);
         await context.SaveChangesAsync();
     }
     catch (Exception)
     {
         throw;
     }
 }