public Photo UpdateOne(Photo entity) { var photo = _providerPhoto.UpdateOne(entity); _providerPhoto.Commit(); return(photo); }
public Tag UpdateOne(EditTagModel model) { var tag = _providerTag.UpdateOne(_converter.ConvertTo(model)); _providerTag.Commit(); return(tag); }
public TextAttributes UpdateOne(TextAttributeModel model) { var attr = _providerAttr.UpdateOne(_converter.ConvertTo(model)); _providerAttr.Commit(); return(attr); }
public Album UpdateOne(Album entity) { var album = _providerAlbum.UpdateOne(entity); _providerAlbum.Commit(); return(album); }
public Photo UpdateOne(PhotoUploadModel model, HttpPostedFileBase file, IImageProcessor processor) { var photoToTags = _providerPhotoToTag.GetAll(); var relatedTagIds = photoToTags.GetRelatedTags(model.Id).Select(x => x.Id).ToArray(); if (relatedTagIds.Length > 0) { _providerPhotoToTag.DeleteMany(relatedTagIds); _providerPhoto.Commit(); //TODO: продумать } if (file != null) { if (file.ContentLength != 0 && file.ContentLength < 4048576) { processor.CreateThumbnail(file, 350, 350, model.FileName); file.SaveAs(HttpContext.Current.Server.MapPath(model.PhotoPath)); } } var photos = _providerPhoto.UpdateOne(_converter.ConvertTo(model)); _providerWatermark.UpdateOne(_converterWatermark.ConvertTo(model.ImageAttributes)); if (model.RelatedTagIds != null) { _providerPhotoToTag.AddMany(model.RelatedTagIds .Select(x => new PhotoToTag() { Id = 0, PhotoId = model.Id, TagId = x }).ToArray() ); } _providerPhoto.Commit(); return(photos); }