public IHttpActionResult PostGameDeveloper(GameDeveloper gameDeveloper) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.GameDevelopers.Add(gameDeveloper); try { db.SaveChanges(); } catch (DbUpdateException) { if (GameDeveloperExists(gameDeveloper.GameId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = gameDeveloper.GameId }, gameDeveloper)); }
internal static void Setup(AppDomain domain) { GameDeveloper = string.Copy(Internal_GetGameDeveloper()); GameName = string.Copy(Internal_GetGameName()); HashCode = string.Copy(Internal_GetHashCode()); CurrentGameAttribute = new MelonGameAttribute(GameDeveloper, GameName); BaseDirectory = string.Copy(Internal_GetBaseDirectory()); GameDirectory = string.Copy(Internal_GetGameDirectory()); SetCurrentDomainBaseDirectory(GameDirectory, domain); UserDataDirectory = Path.Combine(BaseDirectory, "UserData"); if (!Directory.Exists(UserDataDirectory)) { Directory.CreateDirectory(UserDataDirectory); } UserLibsDirectory = Path.Combine(BaseDirectory, "UserLibs"); if (!Directory.Exists(UserLibsDirectory)) { Directory.CreateDirectory(UserLibsDirectory); } IsBONEWORKS = (!string.IsNullOrEmpty(GameDeveloper) && GameDeveloper.Equals("Stress Level Zero") && !string.IsNullOrEmpty(GameName) && GameName.Equals("BONEWORKS")); Main.IsBoneworks = IsBONEWORKS; IsDemeo = (!string.IsNullOrEmpty(GameDeveloper) && GameDeveloper.Equals("Resolution Games") && !string.IsNullOrEmpty(GameName) && GameName.Equals("Demeo")); }
public IHttpActionResult PutGameDeveloper(int id, GameDeveloper gameDeveloper) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != gameDeveloper.GameId) { return(BadRequest()); } db.Entry(gameDeveloper).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GameDeveloperExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { GameDeveloper gameDeveloper = db.GameDeveloper.Find(id); db.GameDeveloper.Remove(gameDeveloper); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Delete(int gameId, int devID) { using (var db = new GameMarketContext()) { gameDevUpdate = db.GameDevelopers.Where(c => c.GameId == gameId && c.DeveloperId == devID).FirstOrDefault(); db.GameDevelopers.Remove(gameDevUpdate); db.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "Id,nazwa,data_rozpoczecia")] GameDeveloper gameDeveloper) { if (ModelState.IsValid) { db.Entry(gameDeveloper).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gameDeveloper)); }
public IHttpActionResult GetGameDeveloper(int id) { GameDeveloper gameDeveloper = db.GameDevelopers.Find(id); if (gameDeveloper == null) { return(NotFound()); } return(Ok(gameDeveloper)); }
public ActionResult Create([Bind(Include = "Id,nazwa,data_rozpoczecia")] GameDeveloper gameDeveloper) { if (ModelState.IsValid) { db.GameDeveloper.Add(gameDeveloper); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(gameDeveloper)); }
public void Create(int gameID, int devID) { GameDeveloper newGameDev = new GameDeveloper() { GameId = gameID, DeveloperId = devID }; using (var db = new GameMarketContext()) { db.GameDevelopers.Add(newGameDev); db.SaveChanges(); } }
public IHttpActionResult DeleteGameDeveloper(int id) { GameDeveloper gameDeveloper = db.GameDevelopers.Find(id); if (gameDeveloper == null) { return(NotFound()); } db.GameDevelopers.Remove(gameDeveloper); db.SaveChanges(); return(Ok(gameDeveloper)); }
// GET: GameDevelopers/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GameDeveloper gameDeveloper = db.GameDeveloper.Find(id); if (gameDeveloper == null) { return(HttpNotFound()); } return(View(gameDeveloper)); }
public void Update(decimal gameID, decimal devID, decimal newdevID) { using (var db = new GameMarketContext()) { var selectedGDRef = db.GameDevelopers.Where(g => g.DeveloperId == devID && g.GameId == gameID).FirstOrDefault(); db.GameDevelopers.Remove(selectedGDRef); GameDeveloper updatedGameDev = new GameDeveloper() { GameId = gameID, DeveloperId = newdevID }; db.GameDevelopers.Add(updatedGameDev); // write changes to database db.SaveChanges(); } }
// GET: GameDevelopers/Delete/5 public ActionResult Delete(int?id) { if (!isAdminUser()) { return(RedirectToAction("Index", "Home")); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GameDeveloper gameDeveloper = db.GameDeveloper.Find(id); if (gameDeveloper == null) { return(HttpNotFound()); } return(View(gameDeveloper)); }
public async Task <Unit> Handle(CreateGameDeveloperCommand request, CancellationToken cancellationToken) { var entity = new GameDeveloper { GameDeveloperId = request.Id, FirstName = request.FirstName, LastName = request.LastName, Age = request.Age, DeveloperLevel = request.DeveloperLevel }; _context.GameDevelopers.Add(entity); await _context.SaveChangesAsync(cancellationToken); await _mediator.Publish(new GameDeveloperCreated { GameDeveloperId = entity.GameDeveloperId }, cancellationToken); return(Unit.Value); }