Exemplo n.º 1
0
 public ActionResult CriarLicenca(Licencas licenca)
 {
     licenca.SoftwareId = Convert.ToInt32(Session["SoftwareId"]);
     bd.Licencas.Add(licenca);
     bd.SaveChanges();
     return(RedirectToAction("ListarLicencas", new { SoftwareId = Convert.ToInt32(Session["SoftwareId"]) }));
 }
Exemplo n.º 2
0
        public ActionResult EditarLicenca(Licencas licenca)
        {
            var licencaBD = bd.Licencas.FirstOrDefault(x => x.LicencaId == licenca.LicencaId);

            licencaBD.Preco      = licenca.Preco;
            licencaBD.Quantidade = licenca.Quantidade;
            licencaBD.SoftwareId = licenca.SoftwareId;

            bd.Entry(licencaBD).State = EntityState.Modified;
            bd.SaveChanges();

            return(RedirectToAction("ListarLicencas", new { SoftwareId = Convert.ToInt32(Session["SoftwareId"]) }));
        }