using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Web;

namespace TP02Photo_sharing.Models
{
    public class Photo
    {
        public int ID { get; set; }
        [Display(Name = "Titre")]
        public string Title { get; set; }
        [Display(Name = "Image")]
        public byte[] PhotoFile { get; set; }
        public string Description { get; set; }

        [Display(Name = "Date creation")]
        [DataType(DataType.Date)]
        public DateTime CreatedDate { get; set; }

        public string Owner { get; set; }        
        public virtual ICollection<Comment> Comments { get; set; }

        [NotMapped, Required]
        public HttpPostedFileBase image { get; set; }


        public bool EmptyModel()
        {
            return ID == 0;
        }
        public bool hasComments()
        {
            return Comments.Count > 0;
        }
    }
}