Esempio n. 1
0
        public async Task <ActionResult> Register([FromForm] RegisterViewModel model)
        {
            var request = Map <RegisterViewModel, RegisterUserRequest>(model);

            var response = await MediatorService.Send(request);

            if (MediatorResponse.IsSuccessful(response))
            {
                return(Ok(response.Result));
            }

            return(BadRequest(response.Errors));
        }
        public async Task <ActionResult> Create(CreateApplicationInstanceViewModel model)
        {
            var request = Map <CreateApplicationInstanceViewModel,
                               RegisterApplicationInstanceRequest>(model);

            var response = await MediatorService.Send(request);

            if (MediatorResponse.IsSuccessful(response))
            {
                return(Ok(response.Result));
            }

            return(BadRequest(response.Errors));
        }
        public async Task <ActionResult> SaveProjectTask(SaveProjectTaskViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var request  = Mapper.Map <SaveProjectTaskViewModel, SaveProjectTaskRequest>(model);
            var response = await Mediator.Send(request);

            if (ResponseHelper.IsSuccessful(response))
            {
                return(Ok(response.Result));
            }

            return(BadRequest(response.Errors));
        }