public void AssignPhotographertoPicture(int PictureID, int PhotographerID) { PhotographerModel model = new PhotographerModel(0, "", "", "", ""); foreach (PhotographerModel photographer in PhotographerList) { if (photographer.ID == PhotographerID) { model = photographer; } } foreach (PictureModel pic in PictureList) { if (pic.ID == PictureID) { pic.Photographer = model; } } }
public PhotographerModel getPhotographer(int ID) { var con = new MySqlConnection(connstr); con.Open(); var stm = "SELECT * FROM `photographer` WHERE ID = @ID;"; var cmd = new MySqlCommand(stm, con); cmd.Parameters.AddWithValue("@ID", ID); cmd.Prepare(); using MySqlDataReader rdr = cmd.ExecuteReader(); PhotographerModel photographer = new PhotographerModel(); while (rdr.Read()) { photographer.FirstName = rdr.GetString("FirstName"); photographer.LastName = rdr.GetString("LastName"); photographer.Birthday = DateTime.Parse(rdr["Birthday"].ToString()); photographer.Notes = rdr.GetString("Notes"); } return(photographer); }
/// <summary> /// Run a query to get a Photographer by Id /// </summary> /// <param name="PhotographerID"> int </param> public PhotographerModel GetPhotographerByID(int PhotographerID) { var Photographer = new PhotographerModel(); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["PhotoConsentDB"].ToString())) { cn.Open(); var sql = string.Format("SELECT * FROM Photographers Where PhotographerID = {0}", PhotographerID); SqlCommand sqlCommand = new SqlCommand(sql, cn); SqlDataReader reader = sqlCommand.ExecuteReader(); while (reader.Read()) { Photographer.FormID = (int)reader["FormID"]; Photographer.Name = (string)reader["Name"]; Photographer.PhotographerID = (int)reader["PhotographerID"]; Photographer.ContactNumber = reader["ContactNumber"] == DBNull.Value ? "" : (string)reader["ContactNumber"]; Photographer.Email = reader["Email"] == DBNull.Value ? "" : (string)reader["Email"]; } cn.Close(); } return(Photographer); }
public List <PhotographerModel> getPhotographers() { var con = new MySqlConnection(connstr); con.Open(); var stm = "SELECT * FROM photographer;"; var cmd = new MySqlCommand(stm, con); using MySqlDataReader rdr = cmd.ExecuteReader(); List <PhotographerModel> photographers = new List <PhotographerModel>(); while (rdr.Read()) { PhotographerModel photographer = new PhotographerModel(); photographer.ID = rdr.GetInt32("ID"); photographer.FirstName = rdr.GetString("FirstName"); photographer.LastName = rdr.GetString("LastName"); photographer.Birthday = DateTime.Parse(rdr["Birthday"].ToString()); photographer.Notes = rdr.GetString("Notes"); photographers.Add(photographer); } return(photographers); }
public void Delete(PhotographerModel photographer) { _photographerBL.DeletePhotographer(photographer); }
public void updatePhotographer(PhotographerModel photographer) { _dal.updatePhotographer(photographer); }
public void savePhotographer(PhotographerModel photographer) { _dal.savePhotographer(photographer); }
public void DeletePhotographer(PhotographerModel model) { _db.Execute("EXEC DeletePhotographer @PhotographerID", new { model.PhotographerID }); }
public void UpdatePhotographer(PhotographerModel model) { _db.Execute("EXEC UpdatePhotographer @Name, @Email, @ContactNumber, @PhotographerID", new { model.Name, model.Email, model.ContactNumber, model.PhotographerID }); }
/// <summary> /// Run SP to input a Photographer into the database /// </summary> /// <param name="model">PhotographerModel - </param> public void InsertPhotographer(PhotographerModel model) { _db.Execute("EXEC InsertPhotographer @FormID, @Name, @Email, @ContactNumber", new { model.FormID, model.Name, model.Email, model.ContactNumber }); }
public EditPhotographer(EditPhotographerVM editPhotographerVM, PhotographerModel selected) { DataContext = editPhotographerVM; _selected = selected; InitializeComponent(); }
public void isVMofPhotographerWithId(int Id) { phm = bl.getPhotographer(Id); }
public void isVMofPhotographerOfPicture(int pictureId) { phm = bl.getPhotographerOfPicture(pictureId); }
/// <summary> /// Saves a photographer to the database /// </summary> /// <param name="photographerModel"></param> public void SavePhotographer(PhotographerModel photographerModel) { ((DataAccessLayer)DataAccessLayer).SavePhotographer(photographerModel); }
/// <summary> /// Updates a photographer /// </summary> /// <param name="photographerModel"></param> public void UpdatePhotographer(PhotographerModel photographerModel) { ((DataAccessLayer)DataAccessLayer).UpdatePhotographer(photographerModel); }
public void SavePhotographer(int id, PhotographerModel photographer) { throw new NotImplementedException(); }