示例#1
0
 /// <summary>
 /// Insert image record
 /// </summary>
 /// <param name="image">Image model</param>
 public void Create(Images image)
 {
     using (var command = new SqlCommand("CreateImage", _connection))
     {
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@Photo", image.PhotoImage);
         command.Parameters.AddWithValue("@OwnerId", image.OwnerId);
         command.Parameters.AddWithValue("@CarId", image.CarId);
         command.ExecuteNonQuery();
     }
 }
示例#2
0
 public static Images Map(SqlDataReader record)
 {
     if (record == null) throw new ArgumentNullException("record");
     var image = new Images
     {
         Id = (int)record["Id"],
         PhotoImage = (byte[])record["Photo"],
         OwnerId = (int)record["OwnerId"],
         CarId = (int)record["CarId"]
     };
     return image;
 }