Exemplo n.º 1
0
        public async Task <IActionResult> AddPhone([FromBody] AddPhoneRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            await _service.AddPhone(request);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Phone> > AddPhone(Phone phone)
        {
            if (phone == null)
            {
                return(BadRequest());
            }
            await phoneService.AddPhone(phone);

            return(Ok(phone));
        }
Exemplo n.º 3
0
        public IHttpActionResult PostPhone(Phone phone)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            service.AddPhone(phone);

            return(CreatedAtRoute("DefaultApi", new { id = phone.ID }, phone));
        }
Exemplo n.º 4
0
        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());
            }
        }
Exemplo n.º 5
0
 public async Task <ServiceResult> PostPhone(PhoneAdd model)
 {
     return(await _phoneService.AddPhone(model));
 }