Beispiel #1
0
 public IActionResult Update(int?bonusId, BonusTbl bonusTbl)
 {
     try
     {
         if (bonusId.HasValue && bonusTbl != null)
         {
             if (bonusTbl.BonusId == bonusId)
             {
                 _bonusTblService.update(bonusTbl);
                 _logger.LogInformation($"Recotrd with id : {bonusId} successfully updated");
                 return(Ok("Record sucessfully updated"));
             }
             else
             {
                 return(NotFound("Sorry no matching record was found"));
             }
         }
         else
         {
             return(BadRequest("There was an error while processing your request"));
         }
     }
     catch (Exception ex)
     {
         _logger.LogError("An error occured while proccessing request ", ex);
         return(BadRequest($"There was an error while proccessing your request {ex}"));
     }
 }
Beispiel #2
0
        public IActionResult Create([FromBody] BonusTbl bonusTbl)
        {
            try
            {
                if (bonusTbl != null)
                {
                    _bonusTblService.Add(bonusTbl);
                    _logger.LogInformation($"Record on BonusTbl successfully added");

                    return(Ok("Record successfully added"));
                }
                else
                {
                    return(BadRequest($"There was an error while processing your request "));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError("An error eoccured", ex);
                return(BadRequest($"There was an error while processing request {ex}"));
            }
        }
Beispiel #3
0
 public void update(BonusTbl bonusTbl)
 {
     _bonusTblRepository.update(bonusTbl);
 }
Beispiel #4
0
 public void Add(BonusTbl bonusTbl)
 {
     _bonusTblRepository.Add(bonusTbl);
 }
Beispiel #5
0
 public void update(BonusTbl bonusTbl)
 {
     _context.Entry(bonusTbl).State = EntityState.Modified;
     _context.SaveChanges();
 }
Beispiel #6
0
 public void Add(BonusTbl bonusTbl)
 {
     _context.BonusTbl.Add(bonusTbl);
     _context.SaveChanges();
 }