public Image_GalleryDto CreateBookmark(Image_GalleryDto a) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var abc = Mapper.Map <Image_GalleryDto, Image_Gallary>(a); context.Image_Gallary.Add(abc); context.SaveChanges(); return(a); }
public void UpdateImage_Gallery(int id, Image_GalleryDto image_GalleryDto) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var admin = context.Image_Gallary.SingleOrDefault(c => c.Image_ID == id); if (admin == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } Mapper.Map(image_GalleryDto, admin); context.SaveChanges(); }