Beispiel #1
0
        public async Task <ActionResult> DeleteConfirmed(Guid id)
        {
            ReclamacaoModel reclamacaoModel = await app.Get(id);

            app.Delete(reclamacaoModel);
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public async Task <ActionResult> Delete(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ReclamacaoModel reclamacaoModel = await app.Get(id.Value);

            if (reclamacaoModel == null)
            {
                return(HttpNotFound());
            }
            return(View(reclamacaoModel));
        }
        public async Task <ActionResult> CriarNovaReclamacao(ReclamacaoModel reclamacao)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                await _contexto.Reclamacoes.AddAsync(reclamacao);

                await _contexto.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }