public async Task <IHttpActionResult> PutArtisan(int id, Artisan artisan) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != artisan.ArtisanId) { return(BadRequest()); } db.Entry(artisan).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArtisanExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult> DeleteConfirmed(int id) { Artisan artisan = await db.Artisans.FindAsync(id); db.Artisans.Remove(artisan); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public static Artisan GetArtisanFromSlug(String slug) { Artisan artisan; using (var stream = DataProvider.FetchData(GetArtisanUrlFromSlug(slug) + ApiLocaleSuffix)) { artisan = Artisan.CreateFromJSonStream(stream); } return(artisan); }
public async Task <IHttpActionResult> GetArtisan(int id) { Artisan artisan = await db.Artisans.FindAsync(id); if (artisan == null) { return(NotFound()); } return(Ok(artisan)); }
public async Task <ActionResult> Edit([Bind(Include = "ArtisanId,DNI,FirstName,LastName,SecondLastName,ArtesanalLine,Cellphone,Email,Address,History,IsActive,CreatedOn")] Artisan artisan) { if (ModelState.IsValid) { db.Entry(artisan).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(artisan)); }
public async Task <IHttpActionResult> PostArtisan(Artisan artisan) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Artisans.Add(artisan); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = artisan.ArtisanId }, artisan)); }
private void exploreCareerArtisanToolStripMenuItem_Click(object sender, EventArgs e) { var careerArtisan = (CareerArtisan)guiD3ProfileTreeView.SelectedNode.Tag; var node = new TreeNode($"Artisan {careerArtisan.Slug}"); var artisan = Artisan.CreateFromSlug(careerArtisan.Slug); node.Nodes.AddRange(CreateNodeFromD3Object(artisan).ToArray()); guiD3ProfileTreeView.Nodes.Add(node); }
public async Task <IHttpActionResult> DeleteArtisan(int id) { Artisan artisan = await db.Artisans.FindAsync(id); if (artisan == null) { return(NotFound()); } db.Artisans.Remove(artisan); await db.SaveChangesAsync(); return(Ok(artisan)); }
// GET: Artisans/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Artisan artisan = await db.Artisans.FindAsync(id); if (artisan == null) { return(HttpNotFound()); } return(View(artisan)); }
public static Pop generatePop(int type, City c) { if (type == 1) { Worker p = new Worker(popNames[rand.Next(popNames.Length)], type); p.city = c; return(p); } if (type == 2) { Artisan p = new Artisan(popNames[rand.Next(popNames.Length)]); p.city = c; return(p); } if (type == 5) { Merchant p = new Merchant(popNames[rand.Next(popNames.Length)]); p.city = c; return(p); } return(null); }
public dynamic getArtisanInformation(Artisan artisan) { return(getObjectFromURL(hostLookup[Host] + "/api/d3/data/artisan/" + artisan.ToString().ToLower())); }
public ArtisanViewModel(Artisan artisan) { this.Artisan = artisan; }
public dynamic getArtisanInformation(Artisan artisan) { return getObjectFromURL(hostLookup[Host] + "/api/d3/data/artisan/" + artisan.ToString().ToLower()); }