コード例 #1
0
        public async Task <ActionResult> Create([Bind(Include = _bindAll)] ExpenseModel expense)
        {
            if (ModelState.IsValid)
            {
                await _service.Add(expense);

                return(RedirectToAction("Index"));
            }

            return(View(expense));
        }
コード例 #2
0
        public Result Add(Expenses Expenses)
        {
            var result = new Result();

            try
            {
                ExpensesService ExpensesService = new ExpensesService();
                ExpensesService.Add(Expenses);
                result.IsSuccess = true;
            }
            catch (Exception exception)
            {
                result.IsSuccess     = false;
                result.ExceptionInfo = exception;
            }
            return(result);
        }