public async Task <IActionResult> Edit([Bind("PhoneNumber,IMEI,DateTime,MobilePhoneCallAddressee,MobilePhoneCallDuration,MobilePhoneCallCost")] MobilePhoneCall mobilePhoneCall) { if (MobilePhoneCallExists(mobilePhoneCall)) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mobilePhoneCall); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MobilePhoneCallExists(mobilePhoneCall)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IMEI"] = new SelectList(_context.MobilePhones, "IMEI", "IMEI", mobilePhoneCall.IMEI); ViewData["PhoneNumber"] = new SelectList(_context.PhoneLines, "PhoneNumber", "PhoneNumber", mobilePhoneCall.PhoneNumber); return(View(mobilePhoneCall)); }
private bool MobilePhoneCallExists(MobilePhoneCall m) { return(_context.MobilePhoneCalls.Any(e => e.PhoneNumber == m.PhoneNumber && e.DateTime == m.DateTime && e.IMEI == m.IMEI && e.MobilePhoneCallAddressee == m.MobilePhoneCallAddressee && e.MobilePhoneCallCost == m.MobilePhoneCallCost && e.MobilePhoneCallDuration == m.MobilePhoneCallDuration)); }
public async Task <IActionResult> DeleteConfirmed([Bind("PhoneNumber,IMEI,DateTime,MobilePhoneCallAddressee,MobilePhoneCallDuration,MobilePhoneCallCost")] MobilePhoneCall mobilePhoneCall) { var _mobilePhoneCall = await _context.MobilePhoneCalls.FindAsync(mobilePhoneCall.PhoneNumber, mobilePhoneCall.IMEI, mobilePhoneCall.DateTime); _context.MobilePhoneCalls.Remove(_mobilePhoneCall); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> DeleteConfirmed([Bind("PhoneNumber,IMEI,DateTime,MobilePhoneCallAddressee,Duration,Cost")] MobilePhoneCall mobilePhoneCall) { var _mobilePhoneCall = await _context.MobilePhoneCalls .Include(m => m.PhoneLine) .FirstOrDefaultAsync(m => m.PhoneNumber == mobilePhoneCall.PhoneNumber && m.DateTime == mobilePhoneCall.DateTime); //var _mobilePhoneCall = await _context.MobilePhoneCalls.FindAsync(mobilePhoneCall.PhoneNumber, mobilePhoneCall.DateTime); _context.MobilePhoneCalls.Remove(_mobilePhoneCall); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), new { phoneNumberCheck = "On", dateTimeCheck = "On", AddressCheck = "On", totalCostCheck = "On", roamingCheck = "On" })); }
public async Task <IActionResult> Create([Bind("PhoneNumber,IMEI,DateTime,MobilePhoneCallAddressee,Duration,Cost")] MobilePhoneCall mobilePhoneCall) { if (ModelState.IsValid) { _context.Add(mobilePhoneCall); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), new { phoneNumberCheck = "On", dateTimeCheck = "On", AddressCheck = "On", totalCostCheck = "On", roamingCheck = "On" })); } ViewData["PhoneNumber"] = new SelectList(_context.PhoneLines, "PhoneNumber", "PhoneNumber", mobilePhoneCall.PhoneNumber); return(View(mobilePhoneCall)); }
public async Task <IActionResult> Create([Bind("PhoneNumber,IMEI,DateTime,MobilePhoneCallAddressee,MobilePhoneCallDuration,MobilePhoneCallCost")] MobilePhoneCall mobilePhoneCall) { if (ModelState.IsValid) { _context.Add(mobilePhoneCall); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IMEI"] = new SelectList(_context.MobilePhones, "IMEI", "IMEI", mobilePhoneCall.IMEI); ViewData["PhoneNumber"] = new SelectList(_context.PhoneLines, "PhoneNumber", "PhoneNumber", mobilePhoneCall.PhoneNumber); return(View(mobilePhoneCall)); }
private bool MobilePhoneCallExists(MobilePhoneCall m) { return(_context.MobilePhoneCalls.Any(e => e.MobilePhoneCallId == m.MobilePhoneCallId)); }