public void UpdateActivity(PortalActivity updActivity) { var currActivity = GetActivity(updActivity.Id); currActivity.Name = updActivity.Name; currActivity.Description = updActivity.Description; currActivity.Date = updActivity.Date; }
public void UpdateActivity(PortalActivity activity) { ExecuteNonQuery($@" UPDATE {PortalActivityTableName} SET Name = '{activity.Name}', Description = '{activity.Description}', Date = '{activity.Date.ToString("MM/dd/yyyy h:mm tt")}' WHERE Id = {activity.Id}; "); }
public void AddActivity(PortalActivity activity) { ExecuteNonQuery($@" INSERT INTO {PortalActivityTableName} (Name, Description, Date) VALUES ('{activity.Name}', '{activity.Description}', '{activity.Date.ToString("MM/dd/yyyy h:mm tt")}' ) "); }
public PortalActivity GetActivity(int id) { DataTable dt = GetDataTable($@"Select Id, Name, Description, Date from {PortalActivityTableName} WHERE Id = {id}"); PortalActivity activity = null; if (dt.Rows.Count > 0) { activity = PortalActivityFromDataRow(dt.Rows[0]); activity.Attendees = GetActivityAttendees(activity.Id).ToList(); } return(activity); }
public IActionResult Create(string modifyDate, [Bind("Name,Description,Date")] PortalActivity activity) { try { if (ModelState.IsValid) { activity.Date = Convert.ToDateTime(modifyDate); _portalRepository.AddActivity(activity); return(RedirectToAction(nameof(Index))); } } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); } return(View(activity)); }
public IActionResult Edit(int id, string modifyDate, [Bind("Id,Name,Description,Date")] PortalActivity activity) { if (id != activity.Id) { return(NotFound()); } try { if (ModelState.IsValid) { activity.Date = Convert.ToDateTime(modifyDate); _portalRepository.UpdateActivity(activity); return(RedirectToAction(nameof(Index))); } } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); } return(View(activity)); }
public void UpdateActivity(PortalActivity activity) { _portalContext.PortalActivity.Update(activity); _portalContext.SaveChanges(); }
public void AddActivity(PortalActivity activity) { _portalContext.PortalActivity.Add(activity); _portalContext.SaveChanges(); }
public void AddActivity(PortalActivity activity) { _activities.Add(activity); }