Example #1
0
        public ActionResult AjaxSave(int id, string sessionUrl)
        {
            var receipt = new Models.Receipt { Id = id };

            if (TryUpdateModel(receipt))
            {
                _repository.Update(Mapper.Map<Code.DataAccess.Receipt>(receipt));
            }

            return View(new GridModel(_sessionService.GetByUrl(sessionUrl).Receipts.Select(x => Mapper.Map<Receipt>(x)).ToArray()));
        }
Example #2
0
        public ActionResult AjaxInsert(string sessionUrl)
        {
            var receipt = new Models.Receipt();

            if (TryUpdateModel(receipt))
            {
                var newExpenditure = Mapper.Map<Code.DataAccess.Receipt>(receipt);
                newExpenditure.SessionId = _sessionService.GetByUrl(sessionUrl).Id;
                _repository.Insert(newExpenditure);
            }

            return View(new GridModel(_sessionService.GetByUrl(sessionUrl).Receipts.Select(x => Mapper.Map<Receipt>(x)).ToArray()));
        }