public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Address,City,State,PostalCode,Country,Phone,Email,Username,Password,ConfirmPassword")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
        public async Task <IActionResult> Create([Bind("ID,Name,Classification,Fee")] Services services)
        {
            if (ModelState.IsValid)
            {
                _context.Add(services);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(services));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("ID,ClientID,ServicesID,Date")] ClientService clientService)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clientService);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientID"] = new SelectList(_context.Client, "ID", "Email", clientService.ClientID);
            return(View(clientService));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("ID,Name,ServicesID,ContactEmail")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contact);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServicesID"] = new SelectList(_context.Services, "ID", "ID", contact.ServicesID);
            return(View(contact));
        }
        public async Task <IHttpActionResult> Patch(Guid key, Delta <Blog> patch)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var blog = await _db.Blogs.FindAsync(key);

            if (blog == null)
            {
                return(NotFound());
            }

            patch.Patch(blog);
            _db.Entry(blog).State = EntityState.Modified;

            await _db.SaveChangesAsync();

            return(Updated(blog));
        }
        public async Task <IHttpActionResult> Patch(Guid key, Delta <Post> patch)
        {
            Validate(patch.GetInstance());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var post = await _db.Posts.FindAsync(key);

            if (post == null)
            {
                return(NotFound());
            }

            patch.Patch(post);
            _db.Entry(post).State = EntityState.Modified;

            await _db.SaveChangesAsync();

            return(Updated(post));
        }
 public async Task <int> SaveAsync()
 {
     return(await _context.SaveChangesAsync());
 }