Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            _providerService.Delete(id);
            _providerService.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public async Task <IActionResult> Delete(int id)
 {
     if (await _providerService.Delete(id))
     {
         return(NoContent());
     }
     return(BadRequest("Fail to delete Provider"));
 }
        public void Delete(Guid id, string searchQueryId = null)
        {
            using (var transaction = ContextManager.NewTransaction())
            {
                providerService.Delete(id);
                transaction.Commit();
            }

            RefreshGridItem(searchQueryId, null, model => model.Id == id);
        }
        public async Task <IActionResult> Delete(Provider provider)
        {
            if (provider == null)
            {
                return(RedirectToAction(nameof(Error)));
            }

            await _providerService.Delete(provider);

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 5
0
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var oldProvider = _providerService.Delete(id);
                    _providerService.Save();

                    var responseData = Mapper.Map <Provider, ProviderViewModel>(oldProvider);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }
                return response;
            }));
        }
Exemplo n.º 6
0
 private void btnDeleteProvider_Click(object sender, EventArgs e)
 {
     if (dtgProviders.SelectedRows.Count > 0)
     {
         if (MessageBox.Show("Tem Certeza que deseja excluir?", "Atenção", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             _providerService.Delete((long)dtgProviders.SelectedRows[0].Cells[4].Value);
             UpdateList();
         }
     }
 }
Exemplo n.º 7
0
 // DELETE api/providers/5
 public HttpResponseMessage Delete(long id)
 {
     try
     {
         _providerService.Delete(id);
         return(Request.CreateResponse(System.Net.HttpStatusCode.Accepted));
     }
     catch
     {
         return(Request.CreateResponse(System.Net.HttpStatusCode.InternalServerError));
     }
 }
Exemplo n.º 8
0
        public async Task <ActionResult <ProviderDTO> > Delete(Guid id)
        {
            var provider = _providerRepository.GetById(id);

            if (provider == null)
            {
                return(NotFound());
            }

            await _service.Delete(id);

            return(CustomResponse());
        }
        public async Task <IActionResult> Delete(string id)
        {
            try
            {
                var result = await ProviderService.Delete(id);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex, "Fox.Provider.Api");
                return(BadRequest(ex));
            }
        }
Exemplo n.º 10
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var response = await _providerService.Delete(id);

                if (response.Status != true)
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError, "Ocurrio un error al realizar la solicitud"));
                }

                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Exemplo n.º 11
0
        public ActionResult Delete(int id, SearchProvider model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            try
            {
                _service.Delete(model);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public async Task <ActionResult> Delete(string cnpj)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var result = await _service.Delete(cnpj);

                if (result == false)
                {
                    return(NotFound());
                }

                return(Ok(result));
            }
            catch (ArgumentException ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Exemplo n.º 13
0
 public ActionResult Delete(int id)
 {
     _providerService.Delete(_providerService.Get(id));
     return(RedirectToAction("Index"));
 }
Exemplo n.º 14
0
 // DELETE: api/Provider/5
 public void Delete(int id)
 {
     _providerService.Delete(id);
 }
Exemplo n.º 15
0
        public ActionResult Delete(Guid id, FormCollection collection)
        {
            _providerService.Delete(id);

            return(RedirectToAction("Index", new ProviderListFiltersModel().GetRouteValues()).WithSuccess("Camion Eliminado"));
        }
Exemplo n.º 16
0
 public ActionResult Delete(int id)
 {
     return(Ok(
                _providerService.Delete(id)));
 }
Exemplo n.º 17
0
 public void Delete(int id)
 {
     _service.Delete(id);
 }
Exemplo n.º 18
0
 public IHttpActionResult Delete(List <string> ids)
 {
     return(Ok(_service.Delete(ids)));
 }