public async Task <IActionResult> Create([FromBody] CreateActivitiesViewModel vm)
        {
            var result = await _services.CreateAsync(_mapper.Map <DirectoryDTO>(vm));

            if (result.IsValid)
            {
                await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Insert, Tables.Activities);

                return(CreatedAtRoute("GetActivities", new { version = "1.0", controller = "Activities", id = result.Result }, vm));
            }
            return(UnprocessableEntity(result.ErrorsList));
        }
        public async Task <IActionResult> Create(ActivitiesViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var result = await _services.CreateAsync(_mapper.Map <DirectoryDTO>(vm));

                return(result.IsValid
                    ? RedirectToAction("Index")
                    : _oops.OutPutError("Activities", "Index", result.ErrorsList));
            }
            return(View(vm));
        }
예제 #3
0
        public async Task <IActionResult> Create([FromBody] CreateActivitiesViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var result = await _services.CreateAsync(_mapper.Map <DirectoryDTO>(vm));

                if (result.IsValid)
                {
                    await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Insert, Tables.Activities);

                    return(Ok(result));
                }
                return(BadRequest(result));
            }
            return(BadRequest());
        }
예제 #4
0
        public async Task <IActionResult> Create(CreateActivitiesViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var result = await _services.CreateAsync(_mapper.Map <DirectoryDTO>(vm));

                if (result.IsValid)
                {
                    await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Insert, Tables.Activities);

                    return(RedirectToAction("Index"));
                }
                TempData["ErrorsList"] = result.ErrorsList;
            }
            return(View(vm));
        }