Exemple #1
0
        public override Item ConvertToEntity()
        {
            var item = base.ConvertToEntity();

            item.Updated     = Id == 0 ? DateTime.Now : Updated;
            item.Brand       = Brand?.ConvertToEntity();
            item.Category    = Category?.ConvertToEntity();
            item.Discount    = Discount;
            item.Description = Description;
            item.Price       = Price;
            item.Identifier  = (string.IsNullOrEmpty(Remote) ? "IN" : Remote) + Updated.Month + (Updated.Year - 2000) + Category?.Id + "-" + Id;
            item.Remote      = Remote;
            item.Photos      = new List <Photo>();
            Photos?.ForEach(p => item.Photos.Add(p.ConvertToEntity()));
            item.Details = new List <Detail>();
            Details?.ForEach(d => item.Details.Add(d.ConvertToEntity()));
            item.ExistingItems = new List <ExistingItem>();
            ExistingItems?.ForEach(e => item.ExistingItems.Add(e.ConvertToEntity()));
            return(item);
        }