public async Task <Guid> CreateAsync(ClaimTypeViewModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var param = ToParam(model); return(await _service.CreateAsync(param)); }
public async Task UpdateAsync(ClaimTypeViewModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } if (!model.Id.HasValue) { throw new ArgumentNullException(nameof(model.Id)); } var param = ToParam(model); await _service.UpdateAsync(param); }
public async Task <IActionResult> UpdateAsync([FromBody] ClaimTypeViewModel model) { if (model == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await _service.UpdateAsync(model); return(NoContent()); }
public async Task <IActionResult> CreateAsync([FromBody] ClaimTypeViewModel model) { if (model == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = await _service.CreateAsync(model); return(Created($"claimtypes/{result}", result)); }
private ClaimTypeParam ToParam(ClaimTypeViewModel model) { return(SimpleMapper.From <ClaimTypeViewModel, ClaimTypeParam>(model)); }