예제 #1
0
        public ActionResult Delete(int id, InstrumentTypesDeleteModel model)
        {
            if (id > 0)
            {
                try
                {
                    int result = InstrumentTypesRepository.Delete(id);

                    if (result > 0)
                    {
                        Success(string.Format("Tipo '{0}' excluído. :)", model.InstrumentType.Name));
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        Error("Houve um problema ao processar sua requisição. :( Tente noavmente.");
                        return(View(model));
                    }
                }
                catch (Exception e)
                {
                    return(View("Error"));
                }
            }
            else
            {
                return(View("Error"));
            }
        }
예제 #2
0
        public ActionResult Delete(int id)
        {
            if (id > 0)
            {
                InstrumentTypesDeleteModel model = new InstrumentTypesDeleteModel();
                model.InstrumentType = InstrumentTypesRepository.Get(id);

                return(View(model));
            }
            else
            {
                return(View("Error"));
            }
        }