Exemplo n.º 1
0
        public virtual TEntity Update(TEntity entity)

        {
            try
            {
                dbSet.Attach(entity);
                context.Entry(entity).State = EntityState.Modified;

                context.SaveChanges();
                return(entity);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public IHttpActionResult PutEmpresas(int id, Empresas empresas)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != empresas.Codigo)
            {
                return(BadRequest());
            }

            db.Entry(empresas).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmpresasExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public virtual TEntity Update(TEntity entity)

        {
            try
            {
                dbSet.Attach(entity);
                context.Entry(entity).State = EntityState.Modified;

                context.SaveChanges();
                return(entity);
            }
            catch (Exception ex)
            {
                AltivaLog.Log.Insertar(ex.ToString(), "Error");
                throw;
            }
        }
 public ActionResult Edit([Bind(Include = "Id,CNPJ,Nome_Fantasia,Telefone,Email,Data_Do_Cadastro")] Empresas empresas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(empresas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(empresas));
 }
Exemplo n.º 5
0
 public ActionResult Edit([Bind(Include = "Id,RazaoSocial,NomeFantasia,CNPJ,Endereco,Bairro,UF,Complemento,CEP,Situacao")] Empresa empresa)
 {
     if (ModelState.IsValid)
     {
         db.Entry(empresa).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(empresa));
 }
Exemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "Id,Nit,RazonSocial,NombreComercial,Representante,JfeRecursos,Ciudad,Direccion,TelefonoFijo,NroCelular,Email,NroEmpleados,Latitud,Longitud,Zona")] COM_Empresas cOM_Empresas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cOM_Empresas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Representante = new SelectList(db.COM_Representantes, "Id", "Identificacion", cOM_Empresas.Representante);
     return(View(cOM_Empresas));
 }