public async Task <IActionResult> PutAsync(int id, SaveApplicationResource resource) { var applications = _mapper.Map <SaveApplicationResource, Application>(resource); var result = await _applicationService.UpdateAsync(id, applications); if (!result.Success) { return(BadRequest(result.Message)); } var ApplicationResource = _mapper.Map <Application, ApplicationResource>(result.Resource); return(Ok(ApplicationResource)); }
public async Task <IActionResult> PostAsync([FromBody] SaveApplicationResource resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var guardian = _mapper.Map <SaveApplicationResource, Application>(resource); var result = await _applicationService.SaveAsync(guardian); if (!result.Success) { return(BadRequest(result.Message)); } var projectResource = _mapper.Map <Application, ApplicationResource>(result.Resource); return(Ok(projectResource)); }
public async Task <IActionResult> PostAsync([FromBody] SaveApplicationResource resource) { var applications = _mapper.Map <SaveApplicationResource, Application>(resource); var result = await _applicationService.SaveAsync(applications); if (!result.Success) { return(BadRequest(result.Message)); } // var ApplicationResource = _mapper.Map <Application, ApplicationResource>(result.Resource); return(Ok(ApplicationResource)); }
public async Task <IActionResult> PutAsync(int id, [FromBody] SaveApplicationResource resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var application = _mapper.Map <SaveApplicationResource, Application>(resource); var result = await _applicationService.UpdateAsync(id, application); if (!result.Success) { return(BadRequest(result.Message)); } var applicationResource = _mapper.Map <Application, ApplicationResource>(result.Resource); return(Ok(applicationResource)); }