public IHttpActionResult Postartwork(artwork artwork) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.artwork.Add(artwork); try { db.SaveChanges(); } catch (DbUpdateException) { if (artworkExists(artwork.id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = artwork.id }, artwork)); }
public IHttpActionResult Putartwork(int id, artwork artwork) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != artwork.id) { return(BadRequest()); } db.Entry(artwork).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!artworkExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { artwork artwork = ga.FindById(id); ga.remove(artwork); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { ShowroomdbContext cnx = new ShowroomdbContext(); artwork artwork = cnx.artworks.Find(id); cnx.artworks.Remove(artwork); cnx.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult Getartwork(int id) { artwork artwork = db.artwork.Find(id); if (artwork == null) { return(NotFound()); } return(Ok(artwork)); }
public ActionResult Edit(int id, ArtworkModels artM) { artwork a = service.GetById(id); a.id = artM.id; a.name = artM.name; a.description = artM.description; a.phot = artM.photo; service.Update(a); service.Commit(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "id,category,descreption,mediaPath,price,releaseDate,title,uploadDate,artist_id")] artwork artwork) { if (ModelState.IsValid) { ga.Create(artwork); return(RedirectToAction("Index")); } return(View(artwork)); }
public IHttpActionResult Deleteartwork(int id) { artwork artwork = db.artwork.Find(id); if (artwork == null) { return(NotFound()); } db.artwork.Remove(artwork); db.SaveChanges(); return(Ok(artwork)); }
// GET: artworks/Delete/5 public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } artwork artwork = ga.FindById(id); if (artwork == null) { return(HttpNotFound()); } return(View(artwork)); }
public static void overlay_draw(osd_bitmap dest, artwork overlay) { int i, j; int height, width; osd_bitmap o = null; int black; o = overlay._artwork; height = overlay._artwork.height; width = overlay._artwork.width; black = Machine.pens[0]; if (dest.depth == 8) { _BytePtr dst, ovr; for (j = 0; j < height; j++) { dst = new _BytePtr(dest.line[j]); ovr = new _BytePtr(o.line[j]); for (i = 0; i < width; i++) { if (dst[0] != black) dst[0] = ovr[0]; dst.offset++; ovr.offset++; } } } else { _ShortPtr dst, ovr; for (j = 0; j < height; j++) { dst = new _ShortPtr(dest.line[j]); ovr = new _ShortPtr(o.line[j]); for (i = 0; i < width; i++) { if (dst.read16(0) != black) dst.write16(0, ovr.read16(0)); dst.offset += 2; ovr.offset += 2; } } } }
static void Main(string[] args) { DatabaseFactory DBF = new DatabaseFactory(); UnitOfWork UF = new UnitOfWork(DBF); JeeModel ctx = new JeeModel(); artwork a = new artwork(); ServicePattern.Service <artwork> SP = new Service <artwork>(UF); a = SP.FindById(1); System.Console.Out.WriteLine(a.title); a.title = "il3asba rabek"; System.Console.Out.WriteLine(a.title); SP.Update(a); SP.remove(a); System.Console.Out.WriteLine(a.title + " after"); System.Console.ReadKey(); }
public ActionResult Edit([Bind(Include = "id,category,descreption,mediaPath,price,releaseDate,title,uploadDate,artist_id")] artwork artwork) { if (ModelState.IsValid) { artwork Yartwork = ga.FindById(artwork.id); Yartwork.title = artwork.title; Yartwork.descreption = artwork.descreption; Yartwork.price = artwork.price; ga.Update(Yartwork); return(RedirectToAction("Index")); } return(View(artwork)); }
// GET: Artwork/Edit/5 public ActionResult Edit(int id) { if (id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } artwork art = service.GetById(id); ArtworkModels artM = new ArtworkModels(); if (art == null) { return(HttpNotFound()); } else { artM.id = art.id; artM.name = art.name; artM.description = art.description; artM.photo = art.phot; return(View(artM)); } }
public ActionResult Create(ArtworkModels artwork, HttpPostedFileBase upload) { try { // TODO: Add insert logic here if (ModelState.IsValid) { ShowroomdbContext ctx = new ShowroomdbContext(); artwork a = new artwork(); a.description = artwork.description; a.name = artwork.name; if (upload != null && upload.ContentLength > 0) { a.phot = Guid.NewGuid().ToString() + Path.GetFileName(upload.FileName); upload.SaveAs(Path.Combine(Server.MapPath("~/Content/ArtworkImages"), a.phot)); } a.artist_id = (int)Session["LogedUserid"]; Debug.WriteLine((int)Session["LogedUserid"]); a.category_id = 1; ctx.artworks.Add(a); ctx.SaveChanges(); // service.Add(a); //service.Commit(); return(RedirectToAction("Index")); } return(View()); } catch { return(View()); } }
static artwork allocate_artwork_mem(int width, int height) { artwork a; int temp; if ((Machine.orientation & ORIENTATION_SWAP_XY) != 0) { temp = height; height = width; width = temp; } a = new artwork(); a.transparency = null; a.orig_palette = null; a.pTable = null; a.brightness = null; a.vector_bitmap = null; a.orig_artwork = osd_create_bitmap(width, height); fillbitmap(a.orig_artwork, 0, null); /* Create a second bitmap for public use */ a._artwork = osd_create_bitmap(width, height); a.pTable = new byte[256 * 256]; a.brightness = new byte[256 * 256]; memset(a.brightness, 0, 256 * 256); /* Create bitmap for the vector screen */ if ((Machine.drv.video_attributes & VIDEO_TYPE_VECTOR) != 0) { a.vector_bitmap = osd_create_bitmap(width, height); fillbitmap(a.vector_bitmap, 0, null); } return a; }
public static int overlay_set_palette(artwork a, byte[] palette, int num_shades) { throw new Exception(); }
public static void overlay_remap(artwork a) { throw new Exception(); }
//internal static void drawgfx(osd_bitmap bitmap, GfxElement gfxElement, int p, int p_2, bool p_3, bool p_4, int sx, int sy, rectangle rectangle, int p_5, int p_6) //{ // throw new NotImplementedException(); //} public static void backdrop_refresh_tables(artwork a) { throw new Exception(); }
public static void artwork_free(ref artwork a) { if (a!=null) { if (a._artwork!=null) osd_free_bitmap(a._artwork); if (a.orig_artwork!=null) osd_free_bitmap(a.orig_artwork); if (a.vector_bitmap!=null) osd_free_bitmap(a.vector_bitmap); if (a.orig_palette != null) a.orig_palette = null; if (a.transparency != null) a.transparency = null; if (a.brightness != null) a.brightness = null; if (a.pTable != null) a.pTable = null; a = null; } }
static void backdrop_set_palette(artwork a, byte[] palette) { /* Load colors into the palette */ if ((Machine.drv.video_attributes & VIDEO_MODIFIES_PALETTE) != 0) { for (int i = 0; i < a.num_pens_used; i++) palette_change_color(i + a.start_pen, palette[i * 3], palette[i * 3 + 1], palette[i * 3 + 2]); palette_recalc(); backdrop_refresh(a); } }
public static void backdrop_refresh(artwork a) { int i, j; int height, width; osd_bitmap back = null; osd_bitmap orig = null; int offset; offset = a.start_pen; back = a._artwork; orig = a.orig_artwork; height = a._artwork.height; width = a._artwork.width; if (back.depth == 8) { for (j = 0; j < height; j++) for (i = 0; i < width; i++) back.line[j][i] = (byte)Machine.pens[orig.line[j][i] + offset]; } else { for (j = 0; j < height; j++) for (i = 0; i < width; i++) back.line[j].write16(i, Machine.pens[orig.line[j].read16(i + offset)]); } }
static void Main(string[] args) { IArtRepo repo = new ArtRepo(); Console.WriteLine("Type database you wish to query"); string input = Console.ReadLine(); if (input == "artwork") { Console.WriteLine("Enter title of art or press a to see all the artwork"); input = Console.ReadLine(); if (input != "a") { //search for artwork by title artwork a = repo.GetArtWork(input); Console.WriteLine($"Artwork name, artist, date of creation, date acquired, type, price, customer phone, location = {a.unique_title}, {a.artist}, {a.date_of_creation},{a.date_acquired},{a.type_of_art},{a.price},{a.customerphone},{a.location}"); } else { List <artwork> ab = repo.GetArtWorks(); //print a list of all the artworks foreach (artwork a in ab) { Console.WriteLine($"Artwork name, artist, date of creation, date acquired, type, price, customer phone, location = {a.unique_title}, {a.artist}, {a.date_of_creation},{a.date_acquired},{a.type_of_art},{a.price},{a.customerphone},{a.location}"); } Console.WriteLine("Would you like to sort by style?"); input = Console.ReadLine(); if (input == "yes") { //sort artwork by style List <artwork> aws = repo.GetArtWorks(); var query = from aw in aws orderby aw.type_of_art ascending select aw; List <artwork> sorted = query.ToList(); foreach (artwork a in sorted) { Console.WriteLine($"Artwork name, artist, date of creation, date acquired, type, price, customer phone, location = {a.unique_title}, {a.artist}, {a.date_of_creation},{a.date_acquired},{a.type_of_art},{a.price},{a.customerphone},{a.location}"); } } } } else if (input == "artist") { Console.WriteLine("Enter name of artist or press a to see all the artists"); input = Console.ReadLine(); if (input != "a") { //search for artist based on name artist a = repo.GetArtist(input); Console.WriteLine($"name, address, phone, birthplace, age, style = {a.name}, {a.address}, {a.phone},{a.birth_place},{a.age},{a.style_of_art}"); } else { //print list of all artists List <artist> ab = repo.GetArtists(); foreach (artist a in ab) { Console.WriteLine($"name, address, phone, birthplace, age, style = {a.name}, {a.address}, {a.phone},{a.birth_place},{a.age},{a.style_of_art}"); } Console.WriteLine("Would you like to sort by style?"); input = Console.ReadLine(); if (input == "yes") { //sort artists by style List <artist> aws = repo.GetArtists(); var query = from aw in aws orderby aw.style_of_art ascending select aw; List <artist> sorted = query.ToList(); foreach (artist a in sorted) { Console.WriteLine($"name, address, phone, birthplace, age, style = {a.name}, {a.address}, {a.phone},{a.birth_place},{a.age},{a.style_of_art}"); } } } } else if (input == "customer") { Console.WriteLine("Enter phone# of customer or press a to see all the customers"); input = Console.ReadLine(); //search for customer by phone number if (input != "a") { customer a = repo.GetCustomer(input); Console.WriteLine($"Customer name, phone, preference = {a.name}, {a.phone}, {a.art_preferences}"); } else { //print a list of all customers List <customer> ab = repo.GetCustomers(); foreach (customer a in ab) { Console.WriteLine($"Customer name, phone, preference = {a.name}, {a.phone}, {a.art_preferences}"); } Console.WriteLine("Would you like to sort by preference?"); input = Console.ReadLine(); if (input == "yes") { //sort customers by art preference List <customer> aws = repo.GetCustomers(); var query = from aw in aws orderby aw.art_preferences ascending select aw; List <customer> sorted = query.ToList(); foreach (customer a in sorted) { Console.WriteLine($"Customer name, phone, preference = {a.name}, {a.phone}, {a.art_preferences}"); } } } } else if (input == "artshow") { Console.WriteLine("Enter art show date and time or press a to see all shows"); input = Console.ReadLine(); if (input != "a") { //find art show by date and time DateTime inputtedDateArt = DateTime.Parse(input); Console.WriteLine("Enter location of show"); input = Console.ReadLine(); art_show a = repo.getArtShow(inputtedDateArt, input); Console.WriteLine($"location, date and time, artist, contact name, contact phone = {a.location},{a.date_and_time},{a.artist},{a.contact_name}, {a.contact_phone}"); } else { //list all art shows List <art_show> ab = repo.getArtShows(); foreach (art_show a in ab) { Console.WriteLine($"location, date and time, artist, contact name, contact phone = {a.location},{a.date_and_time},{a.artist},{a.contact_name}, {a.contact_phone}"); } } } //See potential customers by show Console.WriteLine("Enter datetime of art show"); DateTime inputtedDate = DateTime.Parse(Console.ReadLine()); Console.WriteLine("Enter location of show"); input = Console.ReadLine(); List <customer> potentialCustomers = repo.GetPotentialCustomersByShow(inputtedDate, input); foreach (customer c in potentialCustomers) { Console.WriteLine($"Customer name, phone number = {c.name} , {c.phone}"); } Console.ReadLine(); }