public async Task <IActionResult> Create([Bind("Id,Name,Icon,Url")] Social social)
        {
            if (ModelState.IsValid)
            {
                _context.Add(social);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(social));
        }
        public async Task <IActionResult> Create([Bind("Id,Title,Slug,Text,Author,Date,Photo")] Blog blog)
        {
            if (ModelState.IsValid)
            {
                _context.Add(blog);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(blog));
        }
        public async Task <IActionResult> Create([Bind("Id,Address,Email,PhoneNumber")] Setting setting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(setting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(setting));
        }
Esempio n. 4
0
        public bool Add(Agency model)
        {
            try
            {
                _agencyDbContext.Add(model);
                _agencyDbContext.SaveChanges();
            }
            catch (System.Exception)
            {
                return(false);
            }

            return(true);
        }