示例#1
0
        // [ValidateAntiForgeryToken]
        public ActionResult Create(Service model)
        {
            ViewBag.SegmentId = new SelectList(db.Segments, "SegmentId", "Name", model.SegmentId);
            List <Service> List = db.Services.ToList();

            ViewBag.Serviceliste = new SelectList(List, "ServiceId", "ServiceNavn");
            if (model.ServiceId > 0)
            {
                if (ModelState.IsValid)
                {
                    Service service = db.Services.Find(model.ServiceId);

                    service.Name      = model.Name;
                    service.SegmentId = model.SegmentId;

                    db.Entry(service).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            else
            {
                Service service = new Service();
                service.Name      = model.Name;
                service.SegmentId = model.SegmentId;

                db.Services.Add(service);
                db.SaveChanges();
            }

            return(View(model));
        }
        //  [ValidateAntiForgeryToken]
        public ActionResult Create(Company model)
        {
            List <Company> List = db.Companies.ToList();

            ViewBag.Companylist = new SelectList(List, "CompanyId", "Name", "CompanyNr");

            if (model.CompanyId != 0)
            {
                if (ModelState.IsValid)
                {
                    Company comp = db.Companies.Find(model.CompanyId);

                    //
                    comp.Name            = model.Name;
                    comp.CompanyNr       = model.CompanyNr;
                    db.Entry(comp).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            else
            {
                Company comp = new Company();
                comp.Name      = model.Name;
                comp.CompanyNr = model.CompanyNr;
                db.Companies.Add(comp);
                db.SaveChanges();
            }

            return(View(model));
        }
示例#3
0
        public ActionResult Index(Segment model)
        {
            Segment segment = new Segment();

            segment.Name = model.Name;

            db.Segments.Add(segment);
            db.SaveChanges();
            int segId = segment.SegmentId;

            return(View(model));
        }
示例#4
0
        public ActionResult Index(Supplier model)

        {
            Supplier supplier = new Supplier();

            supplier.Name = model.Name;

            db.Suppliers.Add(supplier);
            db.SaveChanges();
            int supId = supplier.SupplierId;

            return(View(model));
        }
        public ActionResult Index(Integration model)

        {
            Integration integration = new Integration();

            integration.Name = model.Name;

            db.Integrations.Add(integration);
            db.SaveChanges();
            int InteId = integration.IntegrationId;

            return(View(model));
        }
        public ActionResult Index(Dataset model)
        {
            Dataset data = new Dataset();

            data.Name             = model.Name;
            data.Description      = model.Description;
            data.Application.Name = model.Application.Name;
            data.isAccessible     = model.isAccessible;
            data.isAccessible     = model.isAccessible;

            db.Datasets.Add(data);
            db.SaveChanges();
            int dataId = data.DatasetId;

            return(View(model));
        }
        public JsonResult Delete(int ApplicationId)
        {
            Application app = db.Applications.Find(ApplicationId);

            db.Applications.Remove(app);
            db.SaveChanges();

            //Check to see if Application was actually deleted
            if (db.Applications.Find(ApplicationId) == null)
            {
                return(Json(true, JsonRequestBehavior.AllowGet)); // yes
            }
            else
            {
                return(Json(null, JsonRequestBehavior.AllowGet)); // no
            }
        }