Esempio n. 1
0
        public async Task <IActionResult> OnPost()
        {
            var notes = await _note.FindNotes(ID.GetValueOrDefault());

            if (notes == null)
            {
                Note note = new Note();
                await _note.SaveAsync(note);
            }
            //else
            //{
            //    await _note.SaveChangesAsync();

            //}

            return(RedirectToPage("/Customers/Customer", new { id = ID }));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ID, CustomerID, UserID, Comment, Date")] Note note)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    note.ID = 0;
                    await _context.SaveAsync(note);

                    return(LocalRedirect($"~/Customers/Customer/{note.CustomerID}"));
                }
                return(View(note));
            }
            catch (Exception)
            {
                return(Redirect("https://http.cat/500"));
            }
        }