// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(PeopleTypes).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PeopleTypesExists(PeopleTypes.PeopleTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.PeopleTypes.Add(PeopleTypes); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } ContactTypes = await _context.ContactTypes.FindAsync(id); if (ContactTypes != null) { _context.ContactTypes.Remove(ContactTypes); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } People = await _context.People.FindAsync(id); if (People != null) { _context.People.Remove(People); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { //var file = Path.Combine(_) //byte[] imgdata = System.IO.File.ReadAllBytes((this.HttpContext.Request.Form["People.Photo"].ToString())); using (var memoryStream = new MemoryStream()) { await FileUpload.CopyToAsync(memoryStream); People.Photo = memoryStream.ToArray(); } if (!ModelState.IsValid) { return(Page()); } _context.People.Add(People); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }