public async Task <IActionResult> CreateTelecom([Bind(telecomProperties)] TelecomAddressViewModel c) { if (!ModelState.IsValid) { return(View(c)); } c.ID = Guid.NewGuid().ToString(); var o = AddressObjectFactory.CreateDevice(c.ID, c.CountryCode, c.AreaCode, c.Number, c.Extension, c.NationalDirectDialingPrefix, c.DeviceType, c.ValidFrom, c.ValidTo); await addresses.AddObject(o); return(RedirectToAction("Index")); }
public async Task <IActionResult> EditTelecom( [Bind(telecomProperties)] TelecomAddressViewModel c) { var o = await addresses.GetObject(c.ID) as TelecomAddressObject; o.DbRecord.Address = c.Number; o.DbRecord.NationalDirectDialingPrefix = c.NationalDirectDialingPrefix; o.DbRecord.CityOrAreaCode = c.AreaCode; o.DbRecord.RegionOrStateOrCountryCode = c.CountryCode; o.DbRecord.ZipOrPostCodeOrExtension = c.Extension; o.DbRecord.Device = c.DeviceType; o.DbRecord.ValidFrom = c.ValidFrom ?? DateTime.MinValue; o.DbRecord.ValidTo = c.ValidTo ?? DateTime.MaxValue; await addresses.UpdateObject(o); return(RedirectToAction("Index")); }