Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Title")] Occurance occurance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(occurance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(occurance));
        }
        public async Task <IActionResult> Create([Bind("Id,Role")] AdminRole adminRole)
        {
            if (ModelState.IsValid)
            {
                _context.Add(adminRole);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(adminRole));
        }
        public async Task <IActionResult> Create([Bind("Id,DateReturn,TimeReturn,AddressId")] FollowUp followUp)
        {
            if (ModelState.IsValid)
            {
                _context.Add(followUp);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(followUp));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Email,Password,RememberMe")] Admin admin)
        {
            if (ModelState.IsValid)
            {
                _context.Add(admin);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }
Example #5
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Phone,Email,AddressId")] Contact contact)
        {
            if (ModelState.IsValid)
            {
                //Contact.AddressId = addressId;
                _context.Add(contact);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(contact));
        }
        public async Task <IActionResult> Create([Bind("Id,Unit,StreetNumber,StreetName,Suburb,City,Country,Postcode,DoorAnswered,Interested,Notes,Visited,FollowUp")] Address address)
        {
            if (ModelState.IsValid)
            {
                _context.Add(address);
                await _context.SaveChangesAsync();

                //redirects you to details/3 for example
                return(RedirectToAction("Details", new { address.Id }));
                //https://forums.asp.net/t/1909349.aspx?Returning+view+that+is+in+different+folder
            }
            return(View(address));
        }
Example #7
0
 public async void insert(Door door)
 {
     db.doors.Add(door);
     await db.SaveChangesAsync();
 }