예제 #1
0
        public void UpdatePicture(Picture picture)
        {
            var pictureEntity = dbContext.Pictures.Where(x => x.ID == picture.ID).SingleOrDefault();
            if (pictureEntity != null)
            {
                pictureEntity.Description = picture.Description;
                pictureEntity.Name = picture.Name;
                pictureEntity.UserId = picture.UserId;
                pictureEntity.Details = picture.Details;

            }
        }
예제 #2
0
        public Picture CreatePicture(string name, string description,byte[] content, double longitude, double latidude)
        {
            var newPicture = new Picture();
            var newId = GetNextValidPictureId();
            newPicture.ID = newId;
            newPicture.Description = description;
            newPicture.Name = name;
            newPicture.Details = new PictureDetails();
            newPicture.Details.Content = content;
            newPicture.Details.Latitude = latidude;
            newPicture.Details.Longitude = longitude;

            dbContext.Pictures.Add(newPicture);
            dbContext.SaveChanges();

            return newPicture;
        }
 private static PictureModel ConvertPictureToPictureModel(Picture picture)
 {
     PictureModel model = new PictureModel();
     model.Description = picture.Description;
     model.Id = picture.ID;
     model.Name = picture.Name;
     model.UserId = picture.UserId;
     return model;
 }