Ejemplo n.º 1
0
        public ActionResult Create(TaskViewModel task)
        {
            if (!ModelState.IsValid)
            {
                return(View(task));
            }

            _service.Add(_mapper.ToDomain(task));

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Title,Description,CreateDate,UpdateDate,DeletedDate,isActive,CustomerId")] TaskVM task)
        {
            if (ModelState.IsValid)
            {
                task.Id = Guid.NewGuid();
                var newTask = _mapper.Map <TaskVM, Model.Task>(task);
                _taskAppService.Add(newTask);

                return(RedirectToAction(nameof(Index)));
            }
            //ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "Name", task.CustomerId);
            return(View(task));
        }
Ejemplo n.º 3
0
        public async Task <ResponseMessage> Add(Domain.Entities.TaskEntity task)
        {
            try
            {
                var storedBoard = await _taskService.Add(task);

                return(new ResponseMessage(true, storedBoard, "Task created with success!", HttpStatusCode.OK));
            }
            catch (Exception err)
            {
                return(new ResponseMessage(false, null, err.Message, HttpStatusCode.BadRequest));
            }
        }