Example #1
0
        public async Task <IActionResult> Create([Bind("ID,Name")] CategoryViewModel category)
        {
            if (ModelState.IsValid)
            {
                var categoryVo = mapper.Map <CategoryVo>(category);
                await provider.Add(categoryVo);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("ID,Name")] TagViewModel tag)
        {
            if (ModelState.IsValid)
            {
                var tagVo = mapper.Map <TagVo>(tag);
                await provider.Add(tagVo);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tag));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("ID,Name,Description,DeadLineDate,CreationDate,Priority,Status,CategoryID")] TodoItemViewModel todoItem)
        {
            if (ModelState.IsValid)
            {
                var todoItemVo = mapper.Map <TodoItemVo>(todoItem);
                todoItemVo.CreationDate = DateTime.UtcNow;
                await provider.Add(todoItemVo);

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryID"] = new SelectList(categoryProvider.GetEnum(), "ID", "Name", todoItem.CategoryID);
            return(View(todoItem));
        }