Esempio n. 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));
        }
Esempio n. 2
0
        // [ValidateAntiForgeryToken]
        public ActionResult Create(Supplier model)
        {
            List <Supplier> List = db.Suppliers.ToList();

            ViewBag.Segmentliste = new SelectList(List, "SupplierId", "Name");
            if (model.SupplierId > 0)
            {
                if (ModelState.IsValid)
                {
                    Supplier supplier = db.Suppliers.Find(model.SupplierId);

                    supplier.Name = model.Name;

                    db.Entry(supplier).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            else
            {
                Supplier supplier = new Supplier();
                supplier.Name = model.Name;

                db.Suppliers.Add(supplier);
                db.SaveChanges();
            }

            return(View(model));
        }
        // [ValidateAntiForgeryToken]
        public ActionResult Create(Integration model)
        {
            List <Integration> List = db.Integrations.Include(i => i.Application).ToList();

            ViewBag.Integrasjonsliste = new SelectList(List, "IntegrationId", "Navn");
            ViewBag.Appliste          = new SelectList(db.Applications, "ApplicationId", "Name", model.ApplicationId);
            ViewBag.TargetAppliste    = new SelectList(db.Applications, "ApplicationId", "Name", model.TargetApplicationId);

            if (ModelState.IsValid)
            {
                if (model.IntegrationId != 0)
                {
                    Integration integration = db.Integrations.Find(model.IntegrationId);

                    integration.Name                = model.Name;
                    integration.Type                = model.Type;
                    integration.Description         = model.Description;
                    integration.ApplicationId       = model.ApplicationId;
                    integration.TargetApplicationId = model.TargetApplicationId;

                    db.Entry(integration).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    Integration integration = model;
                    db.Integrations.Add(integration);
                    db.SaveChanges();
                }
            }

            return(View(model));
        }
Esempio n. 4
0
        // [ValidateAntiForgeryToken]
        public ActionResult Create(Segment model)
        {
            List <Segment> List = db.Segments.ToList();

            ViewBag.Segmentliste = new SelectList(List, "SegmentId", "SegmentNavn");
            if (model.SegmentId > 0)
            {
                if (ModelState.IsValid)
                {
                    Segment segment = db.Segments.Find(model.SegmentId);

                    segment.Name = model.Name;

                    db.Entry(segment).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            else
            {
                Segment segment = new Segment();
                segment.Name = model.Name;

                db.Segments.Add(segment);
                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));
        }
        // [ValidateAntiForgeryToken]
        public ActionResult Create(Dataset model)
        {
            List <Dataset> List = db.Datasets.ToList();

            ViewBag.Datasetliste  = new SelectList(List, "DatasetId ", "Name");
            ViewBag.ApplicationId = new SelectList(db.Applications, "ApplicationId", "Name", model.ApplicationId);

            if (ModelState.IsValid)
            {
                if (model.DatasetId > 0)
                {
                    Dataset data = db.Datasets.Find(model.DatasetId);
                    data.Name          = model.Name;
                    data.Description   = model.Description;
                    data.ApplicationId = model.ApplicationId;
                    data.isAccessible  = model.isAccessible;
                    data.isMasterData  = model.isMasterData;

                    {
                    }
                    db.Entry(data).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    Dataset data = new Dataset();

                    data = model;

                    db.Datasets.Add(data);
                    db.SaveChanges();
                }
            }
            return(View(model));
        }
        public async Task <ActionResult> Edit([Bind(Include = "ApplicationId,Name,Description,NumberOfUsers,OperatedBy,ContractInformation,InfoLink,Status,Administrator,SuperUsers,Type,LastUpgraded,ExternalUsers,CostYearly,CostInitial,UsesSharedComponents,Strengths,Weaknesses,ContractResignation,BusinessValueScore,ArchitectureFitsScore,ApplicationRiskScore,ApplicationSpeedScore,CompanyId,SegmentId,ServiceId,SupplierId")] Application application)
        {
            if (ModelState.IsValid)
            {
                db.Entry(application).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.CompanyId  = new SelectList(db.Companies, "CompanyId", "Name", application.CompanyId);
            ViewBag.SegmentId  = new SelectList(db.Segments, "SegmentId", "Name", application.SegmentId);
            ViewBag.ServiceId  = new SelectList(db.Services, "ServiceId", "Name", application.ServiceId);
            ViewBag.SupplierId = new SelectList(db.Suppliers, "SupplierId", "Name", application.SupplierId);
            return(View(application));
        }