public ActionResult AddPhotoToAlbum(IEnumerable <Guid> photo, Guid albumId) { var album = AlbumAutomapper.FromBltoUiGetById(albumId); foreach (var item in photo) { var p = PhotoAutomapper.FromBltoUiGetById(item); //album.PhotosAView.Add(p); p.AlbumId = albumId; PhotoAutomapper.FromBltoUiInser(p); } return(Content("OK!")); }
public async Task <ActionResult> AddPhotoToAlbum(IEnumerable <Guid> photo, Guid albumId) { if (photo == null) { return(Json(new { status = 0, Message = "Du måste välja en Photo!" }, JsonRequestBehavior.AllowGet)); } foreach (var item in photo) { var p = await PhotoAutomapper.FromBltoUiGetById(item); p.AlbumId = albumId; await PhotoAutomapper.FromBltoUiEditoUpdateAsync(p); } return(Json(new { status = 1, Message = "Added Photo To Album Success" }, JsonRequestBehavior.AllowGet)); }