コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ReleaseDate,Price")] Formatt formatt)
        {
            if (id != formatt.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(formatt);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FormattExists(formatt.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(formatt));
        }
コード例 #2
0
        public static Paragraph CreateParagraph(DocumentCore docx, string text, Formatt format)
        {
            List <Paragraph> ps = new List <Paragraph>();
            Paragraph        p  = new Paragraph(docx);

            p.ParagraphFormat = format.pFormat.Clone();
            p.Content.Start.Insert(text, format.cFormat.Clone());
            return(p.Clone(true));
        }
コード例 #3
0
        public static Paragraph CreateList(DocumentCore docx, string text, Formatt format)
        {
            Paragraph p = new Paragraph(docx);

            p.ParagraphFormat = format.pFormat.Clone();
            p.Content.Start.Insert(text, format.cFormat.Clone());
            p.ListFormat.Style = Template.StyleBullet;
            p.ParagraphFormat.LeftIndentation    = 15;
            p.ParagraphFormat.SpecialIndentation = -10;
            return(p.Clone(true));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Price")] Formatt formatt)
        {
            if (ModelState.IsValid)
            {
                _context.Add(formatt);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(formatt));
        }