public async Task <CommonDB.Promotion> UpdatePromotion([FromBody] CommonDB.Promotion promotion) { _logger.LogInformation("Promo api before udpate promotion: " + JsonConvert.SerializeObject(promotion)); var result = await _repository.UpdatePromotionAsync(promotion); _logger.LogInformation("Promo api after udpate promotion: "); return(result); }
public async Task <CommonDB.Promotion> DeletePromotionAsync(CommonDB.Promotion promotion) { var promotionToBeUpdated = _context.Promotions.Attach(promotion); promotionToBeUpdated.State = EntityState.Modified; await _context.SaveChangesAsync(); return(promotion); }
public async Task <int> CreatePromotionAsync(CommonDB.Promotion promotion) { _context.Promotions.Add(promotion); var result = await _context.SaveChangesAsync(); var createdPromotionId = (await _context.Promotions.FirstAsync(s => s.PromotionId == promotion.PromotionId)).PromotionId; return(createdPromotionId); }
public async Task <CommonDB.Promotion> DeletePromotion([FromBody] CommonDB.Promotion promotion) { var result = await _repository.DeletePromotionAsync(promotion); return(result); }