public async Task <IActionResult> AddPhone([FromBody] AddPhoneRequest request) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await _service.AddPhone(request); return(Ok()); }
public async Task <ActionResult <Phone> > AddPhone(Phone phone) { if (phone == null) { return(BadRequest()); } await phoneService.AddPhone(phone); return(Ok(phone)); }
public IHttpActionResult PostPhone(Phone phone) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } service.AddPhone(phone); return(CreatedAtRoute("DefaultApi", new { id = phone.ID }, phone)); }
public async Task <IActionResult> AddPhone([FromBody] PhoneModel model) { if (model.Id != Guid.Empty) { return(BadRequest()); } else { var mapped = _mapper.Map <Phone>(model); mapped.Id = Guid.NewGuid(); await _phoneService.AddPhone(mapped); return(Ok()); } }
public async Task <ServiceResult> PostPhone(PhoneAdd model) { return(await _phoneService.AddPhone(model)); }