예제 #1
0
        // public async Task<IActionResult> Create([Bind("Id,CostYear,PlanName,NumberLaw,DefiProjectCalss,ExecutiveUnit,PlanHost,ProjectClass,KeywordTw,SummaryTw,KeywordEng,SummaryEng")] Knowledged knowledge)
        public async Task <IActionResult> Create(KnowledgeViewModel vm_knowledge)
        {
            if (ModelState.IsValid)
            {
                Knowledged knowledgeds = new Knowledged
                {
                    Id               = vm_knowledge.Id,
                    CostYear         = vm_knowledge.CostYear,
                    PlanName         = vm_knowledge.PlanName,
                    NumberLaw        = vm_knowledge.NumberLaw,
                    DefiProjectClass = vm_knowledge.DefiProjectClass,
                    ExecutiveUnit    = vm_knowledge.ExecutiveUnit,
                    PlanHost         = vm_knowledge.PlanHost,
                    ProjectClass     = vm_knowledge.ProjectClass,
                    KeywordTw        = vm_knowledge.KeywordTw,
                    SummaryTw        = vm_knowledge.SummaryTw,
                    KeywordEng       = vm_knowledge.KeywordEng,
                    InfoLink         = vm_knowledge.InfoLink
                };

                _context.Add(knowledgeds);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vm_knowledge));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,TagName")] Tag tag)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tag);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tag));
        }
예제 #3
0
        public async Task <IActionResult> Delete(int id)
        {
            var _data = await context.Infos.FindAsync(id);

            context.Infos.Remove(_data);
            await context.SaveChangesAsync();

            return(RedirectToAction("List"));
        }