/// <summary> /// /// </summary> /// <returns>Stand</returns> private List <Stands> GetAllStands() { List <Stands> stand = null; FileStatus = FileMessage.None; try { using (StandRepository sRepository = new StandRepository()) { stand = sRepository.GetAll() as List <Stands>; }; if (stand != null) { FileStatus = FileMessage.Complete; } else { FileStatus = FileMessage.RecordNotFound; } } catch (Exception) { FileStatus = FileMessage.FileAccessError; } return(stand); }
/// /// retrieve a stand using the repository /// private Stands GetStand(int id) { Stands stand = null; FileStatus = FileMessage.None; try { using (StandRepository sRepository = new StandRepository()) { stand = sRepository.GetById(id); }; if (stand != null) { FileStatus = FileMessage.Complete; } else { FileStatus = FileMessage.RecordNotFound; } } catch (Exception) { FileStatus = FileMessage.FileAccessError; } return(stand); }
/// <summary> /// add a new stand /// </summary> /// <returns>Stand</returns> /// public void AddStand(Stands stand) { try { if (stand != null) { using (StandRepository sRepository = new StandRepository()) { sRepository.Add(stand); }; FileStatus = FileMessage.Complete; } } catch (Exception) { FileStatus = FileMessage.FileAccessError; } }
/// <summary> /// Delete a widget by id /// </summary> /// <returns>Stand</returns> /// public void DeleteStand(int Id) { try { if (GetStand(Id) != null) { using (StandRepository sRepository = new StandRepository()) { sRepository.Delete(Id); FileStatus = FileMessage.Complete; } } else { FileStatus = FileMessage.RecordNotFound; } } catch (Exception) { FileStatus = FileMessage.FileAccessError; } }
/// <summary> /// update a stand /// </summary> /// <returns>Stand</returns> /// public void UpdateStand(Stands updatedStand) { try { if (GetStand(updatedStand.Id) != null) { using (StandRepository repo = new StandRepository()) { repo.Update(updatedStand); } FileStatus = FileMessage.Complete; } else { FileStatus = FileMessage.RecordNotFound; } } catch (Exception) { FileStatus = FileMessage.FileAccessError; } }