示例#1
0
 public ActionResult Guardar(Empresa Emp, HttpPostedFileBase image)
 {
     if (ModelState.IsValid)
     {
         var vExiste = T_Empresa.Obtener(Emp.Emp_Cia);
         if (vExiste == null)
         {
             if (image != null)
             {
                 byte[] data = new byte[image.ContentLength];
                 image.InputStream.Read(data, 0, image.ContentLength);
                 Emp.Emp_Imagen = data;
             }
             T_Empresa.Guardar(Emp);
             return(RedirectToAction("Index", "Empresa"));
         }
         else
         {
             ViewBag.Existe = "S";
             return(View("~/Views/Empresa/Nuevo.cshtml", Emp));
         }
     }
     else
     {
         return(View("~/Views/Empresa/Nuevo.cshtml", Emp));
     }
 }
示例#2
0
        public JsonResult Guardar(Empresa model, HttpPostedFileBase Foto)
        {
            var rm = new ResponseModel();

            if (ModelState.IsValid)
            {
                rm = empresalogic.Guardar(model, Foto);

                if (rm.response)
                {
                    rm.href = Url.Content("~/admin/contenido/");
                }
            }

            return(Json(rm));
        }