public virtual void Create(Contact contact) { if(contact.Name.Length == 0) throw new Exception("where is the name?"); _log.Log("about to add a contact called " + contact.Name); var sw = Stopwatch.StartNew(); _contactStore.Add(contact); sw.Stop(); _log.Log(string.Format("successfully added contact called {0} in {1} milliseconds", contact.Name, sw.ElapsedMilliseconds)); }
public ActionResult Add(ContactAddModel model) { if (!ModelState.IsValid) { return View(model); } var contact = new Contact() { Name = model.Name }; _contactCreator.Create(contact); return RedirectToAction("Index"); }
public int Put(Contact value) { var result = 0; if (value.id > 0) { _service.Update(value); result = value.id; } else { result = _service.Add(value); } return result; }
public int Put(Contact contact) { var result = 0; if (contact.Id > 0) { _service.Update(contact); result = contact.Id; } else { result = _service.Add(contact); } return result; }
public ContactIndexModel() { Contacts = new Contact[] {}; }
public void Add(Contact contact) { Contacts.Add(contact); }
private static Contact GetContact() { var contact = new Contact() { FirstName = "Sean", LastName = "Smith", Email = "*****@*****.**", Phone = "6026906461", Priority = 1 }; return contact; }
public void Post(Contact value) { _service.Update(value); }
private static Contact GetContact() { var contact = new Contact() { firstName = "Sean", lastName = "Smith", emails = new List<string>() { "*****@*****.**" }, }; return contact; }
public override void Create(Contact contact) { base.Create(contact); _roleStore.MapContactToRole(contact, "manager"); }