public void Add(int customerId, Telephone telephone) { var addr = new Telephone { CustomerId = customerId, PhoneNumber = telephone.PhoneNumber, IsPrimary = telephone.IsPrimary, ModifiedDate = DateTime.Now }; _dataContext.Telephones.AddObject(addr); _dataContext.SaveChanges(); }
public void Edit(int telephoneId, Telephone telephone) { Telephone entityToEdit = (from cust in _dataContext.Telephones where cust.Id == telephoneId select cust).FirstOrDefault(); entityToEdit.IsPrimary = telephone.IsPrimary; entityToEdit.CustomerId = telephone.CustomerId; entityToEdit.IsPrimary = telephone.IsPrimary; entityToEdit.PhoneNumber = telephone.PhoneNumber; entityToEdit.ModifiedDate = DateTime.Now; _dataContext.SaveChanges(); }
public ActionResult Create(int customerId, Telephone telephone) { try { _repository.Add(customerId, telephone); var telephoneToDisplay = new TelephoneViewModel { CustomerId = customerId, Id = telephone.Id, PhoneNumber = telephone.PhoneNumber, IsPrimary = telephone.IsPrimary, ModifiedDate = telephone.ModifiedDate }; return RedirectToAction("Index", telephoneToDisplay); } catch { return View(); } }
public void Edit(int telephoneId, Telephone telephone) { _telephoneRepository.Edit(telephoneId, telephone); }
public void Add(int customerId, Telephone telephone) { _telephoneRepository.Add(customerId, telephone); }
/// <summary> /// Deprecated Method for adding a new object to the Telephones EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTelephones(Telephone telephone) { base.AddObject("Telephones", telephone); }
/// <summary> /// Create a new Telephone object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="customerId">Initial value of the CustomerId property.</param> /// <param name="phoneNumber">Initial value of the PhoneNumber property.</param> /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param> /// <param name="isPrimary">Initial value of the IsPrimary property.</param> public static Telephone CreateTelephone(global::System.Int32 id, global::System.Int32 customerId, global::System.String phoneNumber, global::System.DateTime modifiedDate, global::System.Boolean isPrimary) { Telephone telephone = new Telephone(); telephone.Id = id; telephone.CustomerId = customerId; telephone.PhoneNumber = phoneNumber; telephone.ModifiedDate = modifiedDate; telephone.IsPrimary = isPrimary; return telephone; }