public Decimal SaveProductVideo(ProductVideos productVideo) { using (var context = new UniversityEntities()) { var productVideoExising = context.ProductVideos.FirstOrDefault(y => y.Id == productVideo.Id && y.IsDeleted != true); if (productVideoExising != null) { productVideoExising.AssocitedCustID = productVideo.AssocitedCustID; productVideoExising.UpdatedDate = DateTime.UtcNow; productVideoExising.Title = productVideo.Title; productVideoExising.Decription = productVideo.Decription; if (!string.IsNullOrWhiteSpace(productVideo.VideoURL)) { productVideoExising.VideoURL = productVideo.VideoURL; } if (!string.IsNullOrWhiteSpace(productVideo.ThumbnailURL)) { productVideoExising.ThumbnailURL = productVideo.ThumbnailURL; } context.SaveChanges(); return(productVideoExising.Id); } else { productVideo.CreatedDate = DateTime.UtcNow; context.ProductVideos.Add(productVideo); context.SaveChanges(); return(productVideo.Id); } } }
public bool UpdateProductvideo(ProductVideos model) { using (var context = new UniversityEntities()) { var productvideo = context.ProductVideos.FirstOrDefault(y => y.Id == model.Id && y.IsDeleted != true); if (productvideo != null) { productvideo.Decription = model.Decription; productvideo.Title = model.Title; productvideo.ProductId = model.ProductId; productvideo.ThumbnailURL = model.ThumbnailURL; //productvideo.AssocitedID = model.AssocitedID; if (!string.IsNullOrWhiteSpace(model.VideoURL)) { productvideo.VideoURL = model.VideoURL; } productvideo.IsDeleted = false; productvideo.UpdatedDate = DateTime.UtcNow; context.SaveChanges(); } else { model.CreatedDate = DateTime.UtcNow; model.IsDeleted = false; context.ProductVideos.Add(model); context.SaveChanges(); } return(true); } }
public bool UpdateProductvideo(ProductVideos model) { return(_productRepository.UpdateProductvideo(model)); }
public Decimal SaveProductVideo(ProductVideos productVideo) { return(_productRepository.SaveProductVideo(productVideo)); }