public void AddProduct <T>(T dto) { Snappfood snappfoodProduct = (Snappfood)Convert.ChangeType(dto, typeof(Snappfood)); using (SnappfoodMongoDBRepository db = new SnappfoodMongoDBRepository()) { db.AddSnappfood(snappfoodProduct); } }
//public void AddDigikalaBasePage(DigikalaPageBaseDTO dto) //{ // DigikalaBasePage model = new DigikalaBasePage(); // model.CreateDate = DateTime.Now; // model.ChangeFreq = dto.ChangeFreq; // model.ImageCaption = dto.ImageCaption; // model.ImageLoc = dto.ImageLoc; // model.Loc = dto.Loc; // model.Priority = dto.Priority; // digikalaBasePages.Insert(model); //} //public void AddDigikalaBasePages(List<DigikalaPageBaseDTO> dtos) //{ // List<DigikalaBasePage> models = new List<DigikalaBasePage>(); // DateTime CreateDate = DateTime.Now; // foreach (var dto in dtos) // { // DigikalaBasePage model = new DigikalaBasePage(); // model.DKP = dto.DKP; // model.Crawled = false; // model.CreateDate = CreateDate; // model.ChangeFreq = dto.ChangeFreq; // model.ImageCaption = dto.ImageCaption; // model.ImageLoc = dto.ImageLoc; // model.Loc = dto.Loc; // model.Priority = dto.Priority; // model.CrawlDate = null; // models.Add(model); // } // digikalaBasePages.InsertBatch(models); //} public void AddSnappfood(Snappfood dto) { snappfoodProducts.Insert(dto); }