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}")); } }
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}")); } }
public void update(BonusTbl bonusTbl) { _bonusTblRepository.update(bonusTbl); }
public void Add(BonusTbl bonusTbl) { _bonusTblRepository.Add(bonusTbl); }
public void update(BonusTbl bonusTbl) { _context.Entry(bonusTbl).State = EntityState.Modified; _context.SaveChanges(); }
public void Add(BonusTbl bonusTbl) { _context.BonusTbl.Add(bonusTbl); _context.SaveChanges(); }