public async Task <IActionResult> OnPostAsync(int?id, AgencySuperSetup AgencySuperSetup) { if (!ModelState.IsValid) { return(Page()); } //var newAgencySuperSetup = new AgencySuperSetup //{ // Code = AgencySuperSetup.Code, // ShortCode = AgencySuperSetup.ShortCode, // Name = AgencySuperSetup.Name, // Address1 = AgencySuperSetup.Address1, // Address2 = AgencySuperSetup.Address2, // Country = AgencySuperSetup.Country, // State = AgencySuperSetup.State, // City = AgencySuperSetup.City, // ZipCode = AgencySuperSetup.ZipCode, // PhoneNo = AgencySuperSetup.PhoneNo, // Email = AgencySuperSetup.Email, // WebAddress = AgencySuperSetup.WebAddress, // NameOfCPerson = AgencySuperSetup.NameOfCPerson, // CPersonPhone = AgencySuperSetup.CPersonPhone, // CPersonEmail = AgencySuperSetup.CPersonEmail, // Deactivate = AgencySuperSetup.Deactivate ="0", // //Datedectivated = AgencySuperSetup.Datedectivated, //}; _context.AgencySuperSetup.Add(AgencySuperSetup); await _context.SaveChangesAsync(); ModelState.Clear(); return(Page()); }
public async Task <IActionResult> PutAgencySuperSetup(int id, AgencySuperSetup agencySuperSetup) { if (id != agencySuperSetup.Id) { return(BadRequest()); } _context.Entry(agencySuperSetup).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AgencySuperSetupExists(id)) { return(NotFound()); } else { throw; } } return(Ok(agencySuperSetup)); }
public async Task <ActionResult <AgencySuperSetup> > PostAgencySuperSetup(AgencySuperSetup agencySuperSetup) { // updateCourse.Name = editCourses.CourseName; _context.AgencySuperSetup.Add(agencySuperSetup); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAgencySuperSetup", new { id = agencySuperSetup.Id }, agencySuperSetup)); }