public ActionResult DeleteConfirmed(int id) { Motoboy motoboy = db.Motoboys.Find(id); db.Motoboys.Remove(motoboy); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "MotoboyId,Nome,Telefone,Celular,CPF,Dia_Aniversario,Mes_Aniversario,Ano_Aniversario,Email,CEP,Complemento,Bairro,Rua,Cidade,Referencia,Observacao,numerCnh")] Motoboy motoboy) { if (ModelState.IsValid) { db.Entry(motoboy).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(motoboy)); }
// GET: Motoboys/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Motoboy motoboy = db.Motoboys.Find(id); if (motoboy == null) { return(HttpNotFound()); } return(View(motoboy)); }
static void Main(string[] args) { // SRP - Single Resposibility Principle //ClassResponsibleForEverything everything = new ClassResponsibleForEverything(); //everything.DoEverything(); CustomerService customerService = new CustomerService(); SRP.Solution.Customer customer = new SRP.Solution.Customer("Walter Cardoso", "*****@*****.**", "44177673839"); customerService.Save(customer); Console.ReadLine(); // OCP - Open Closed Principle //Person person = new Person() //{ // GivenName = "Bilbo", // Lastname = "Bolseiro" //}; //Employee employee = new Account().Create(person); //Console.WriteLine($"{employee.FullName} - {employee.Email}"); //Console.ReadLine(); IPerson person = new Motoboy() { GivenName = "Bilbo", Lastname = "Bolseiro" }; Employee employee = person.Account.Create(person); Console.WriteLine($"{employee.FullName} - {employee.Email}"); Console.ReadLine(); }