public ActionResult CambiarFotoEmpresa(int id, FileViewModel model)
        {
            try
            {
                if (model.file != null)
                {
                    var empresa = service.GetEmpresaById(id);

                    empresa.Foto = FotosService.SubirFotoEmpresa(model.file, System.IO.Path.Combine(Startup.entorno.WebRootPath, "uploads"));
                    var res = service.Update(empresa);
                    Sesion.Sesion.SetFotoEmpresa(HttpContext.Session, res.Foto);
                }

                return(Json(new { success = true }));
            }
            catch (Exception ex)
            {
                AltivaLog.Log.Insertar(ex.ToString(), "Error");
                return(BadRequest());
            }
        }
Example #2
0
 public TbGeEmpresa Update(EmpresaViewModel model)
 {
     return(service.Update(ViewModelToDomainEditar(model)));
 }