public async Task <IActionResult> Edit(int id, [Bind("Id,Address,City,ZipCode,Country,GeolocationCoordinates")] CalendarSetUp calendarSetUp) { if (id != calendarSetUp.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(calendarSetUp); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CalendarSetUpExists(calendarSetUp.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(calendarSetUp)); }
public async Task <IActionResult> Create([Bind("Id,TitleOfScheduleS,Address,City,ZipCode,Country,GeolocationCoordinates")] CalendarSetUp calendarSetUp) { if (ModelState.IsValid) { _context.Add(calendarSetUp); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View("/Index")); }
public async Task <bool> UpdateCalendarSetUp(CalendarSetUp calendar) { try { _contextPostgres .CalendarSetUps .Update(calendar); /* return*/ return(await _contextPostgres.SaveChangesAsync() > 0); } catch (Exception exc) { return(false); } }