示例#1
0
        // GET: ClienteController/Details/5
        public ActionResult DetailsCliente(int id)
        {
            SucursalProductoVM model = new SucursalProductoVM();

            var resultado = new ClienteLogica().ObtenerClientePorCodigo(id);

            if (resultado.GetType() == typeof(ErrorDTO))
            {
                model.Error = (ErrorDTO)resultado;
            }
            else
            {
                model.Cliente = (ClienteDTO)resultado;
            }
            return(View(model));
        }
示例#2
0
        public ActionResult CreateCliente(ClienteDTO model)
        {
            try
            {
                var resultado = new ClienteLogica().AgregarCliente(model);


                if (resultado.GetType() == typeof(ErrorDTO))
                {
                    throw new Exception("Error");
                }
                else
                {
                    return(RedirectToAction("DetailsCliente", new { id = resultado.IdEntidad }));
                    // return RedirectToAction(nameof(Index));
                }
            }
            catch
            {
                return(View());
            }
        }