public JsonResult Modify(Main_Cashback model) { try { if (model.Id == 0) { model.CreateDate = DateTime.Now; CashbackService.InsertCashback(model); } else { var update = CashbackService.GetCashback(model.Id); update.Linked_SiteId = model.Linked_SiteId; update.CategoriesId = model.CategoriesId; update.PercentId = model.PercentId; update.CreateDate = DateTime.Now; update.Flag = model.Flag; CashbackService.UpdateCashback(update); } CashbackService.Save(); return(Json(new MessageResults { Status = "Success" }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new MessageResults { Status = "Error" }, JsonRequestBehavior.AllowGet)); } }
private void NewTransaction(string message) { try { var transaction = JsonConvert.DeserializeObject <TransactionMessage>(message); _cashbackService.InsertCashback(new NewTransactionCashbackDto { TransactionId = transaction.TransactionId, Value = transaction.Value }); } catch (Exception ex) { TransactionException(ex); } }