public IActionResult Create(ChangeForm model) { model.date = DateTime.Now.ToString("dd/mm/yyyy"); _context.changeForms.Add(model); model.status = "Waiting Approval"; _context.SaveChanges(); return(RedirectToAction("ListAll", "App")); }
public void Should_throw_exception_if_player_not_found() { var cmd = new ChangeForm { PlayerId = 23, FormId = oldFormSource.Id }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message.EqualTo("Player with ID 23 could not be found")); }
private void RunAway() { ChangeForm changeForm = followedTarget.GetComponent <ChangeForm>(); if (changeForm != null && changeForm.hasTransformed && Vector3.Distance(body.position, followedTarget.position) <= enemyDetectingRadius) { move(body.position - followedTarget.position, runningSpeed); //flipX(moveDir); } }
void Awake() { //Obtain components rb = GetComponent <Rigidbody>(); playerRotation = GetComponent <PlayerRotation>(); raycastDetection = GetComponent <RaycastDetection>(); animator = GetComponent <Animator>(); changeForm = GetComponent <ChangeForm>(); respawnPos = transform.position; }
private void edit_Click(object sender, EventArgs e) { ChangeForm frm = new ChangeForm() { Dock = DockStyle.Fill, TopLevel = false, TopMost = true }; showpnl(frm); frm.Show(); }
public void Should_throw_exception_if_form_source_not_found() { new PlayerBuilder() .With(p => p.Id, 23) .BuildAndSave(); var cmd = new ChangeForm { PlayerId = 23, FormId = -123 }; Assert.That(() => Repository.Execute(cmd), Throws.TypeOf <DomainException>().With.Message.EqualTo("FormSource with ID -123 could not be found")); }
private void ChangePartNumberButton_Click(object sender, EventArgs e) { if (m_SearchForm.SelectedRows.Count <= 0) { return; } DataRow row = m_SearchForm.SelectedRows[0]; ChangeForm changeForm = new ChangeForm(row["Lot ID"].ToString()); if (changeForm.ShowDialog() == DialogResult.OK) { m_SearchForm.RunSearch(); } changeForm.Dispose(); }
public void Should_change_player_form() { new PlayerBuilder() .With(p => p.Id, 23) .With(p => p.FormSource, oldFormSource) .With(p => p.Gender, PvPStatics.GenderMale) .BuildAndSave(); var cmd = new ChangeForm { PlayerId = 23, FormId = newFormSource.Id }; Assert.That(() => DomainRegistry.Repository.Execute(cmd), Throws.Nothing); Assert.That(DataContext.AsQueryable <Player>().Where(p => p.Id == 23 && p.Gender == PvPStatics.GenderFemale && p.FormSource.Id == 3 && p.FormSource.FriendlyName == "werewolf"), Has.Exactly(1).Items); }
public IActionResult Transact(ChangeForm transactionData) { User thisUser = dbContext.Users .Include(u => u.Transactions) .FirstOrDefault(u => u.UserID == HttpContext.Session.GetInt32("user")); if (transactionData.Amount == 0) { ModelState.AddModelError("Amount", "Enter an amount"); } else if (transactionData.Amount < 0) { if (Math.Abs(transactionData.Amount) > thisUser.Balance) { ModelState .AddModelError("Amount", "Insufficient funds"); } } if (!ModelState.IsValid) { return(RedirectToAction("Account", new{ id = HttpContext.Session.GetInt32("user") })); } thisUser.Balance += transactionData.Amount; Transaction newTransaction = new Transaction(); newTransaction.Amount = transactionData.Amount; newTransaction.UserID = (int)HttpContext.Session.GetInt32("user"); newTransaction.CreatedAt = DateTime.Now; dbContext.Transactions.Add(newTransaction); dbContext.SaveChanges(); return(RedirectToAction("Account", new{ id = HttpContext.Session.GetInt32("user") })); }
public void should_set_location_to_item_location_if_unowned_item_or_pet() { var player = new PlayerBuilder() .With(p => p.Id, 249) .With(p => p.FormSource, oldFormSource) .With(p => p.Gender, PvPStatics.GenderMale) .With(i => i.Item, new ItemBuilder() .With(i => i.dbLocationName, "mibbitworld") .With(i => i.Id, 123456) .With(i => i.Owner, null) .BuildAndSave()) .BuildAndSave(); var cmd = new ChangeForm { PlayerId = player.Id, FormId = newFormSource.Id }; Assert.That(() => DomainRegistry.Repository.Execute(cmd), Throws.Nothing); Assert.That(DataContext.AsQueryable <Player>().Single(p => p.Id == player.Id).Location, Is.EqualTo("mibbitworld")); }
public async Task <object> Change(ChangeForm change) => await SaveEdit(change);
public ChangePasswordViewModel () { Form = new ChangeForm(); }