public bool CreateMemo(MemoCreate model)
        {
            var entity =
                new Memo()
            {
                TransactionId = model.TransactionId,
                MemoContent   = model.MemoContent
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Memos.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #2
0
        public ActionResult Create(MemoCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreateMemoService();

            if (service.CreateMemo(model))
            {
                TempData["SaveResult"] = "Your memo was created.";
                return(RedirectToAction("Index"));
            }
            ;

            return(View(model));
        }