Exemplo n.º 1
0
        public ActionResult DeletePost(int id)
        {
            EthicalOrganization ethicalOrganization = _db.EthicalOrganizations.Find(id);

            _db.EthicalOrganizations.Remove(ethicalOrganization);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
            }
            EthicalOrganization ethicalOrganization = _db.EthicalOrganizations.Find(id);

            if (ethicalOrganization == null)
            {
                return(HttpNotFound());
            }
            return(View(ethicalOrganization));
        }
Exemplo n.º 3
0
        // Create Method
        public bool CreateEthicalOrganization(ECreate model)
        {
            var entity =
                new EthicalOrganization()
            {
                Id = _userId,
                EthicalOrganizationName = model.EthicalOrganizationName,
                CrueltyFree             = model.CrueltyFree,
                Sustainable             = model.Sustainable,
                Diverse  = model.Diverse,
                ECountry = model.ECountry,
                EImprove = model.EImprove
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.EthicalOrganizations.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }