public async Task <IActionResult> Create(Contacts contacts) { if (contacts.ContactType == Contacts.ContactTypes.Location) { if (!ValidateLocationValues(contacts.ContactText)) { return(NotFound("Lütfen Geçerli Bir Lokasyon Giriniz!")); } } else if (contacts.ContactType == Contacts.ContactTypes.Mail) { if (!new EmailAddressAttribute().IsValid(contacts.ContactText)) { return(NotFound("Lütfen Geçerli Bir Mail Adresi Giriniz!")); } } else if (contacts.ContactType == Contacts.ContactTypes.Phone) { if (!new PhoneAttribute().IsValid(contacts.ContactText)) { return(NotFound("Lütfen Geçerli Bir Telefon Numarası Giriniz!")); } } _context.Add(contacts); await _context.SaveChangesAsync(); return(Ok(contacts)); }
public async Task <IActionResult> Create([Bind("Id,ConfigrationId,DefectInPhone,IsRepairable,RepairDate")] Repair repair) { if (ModelState.IsValid) { _context.Add(repair); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(repair)); }
public async Task <IActionResult> Create([Bind("PhoneId,NameOfPhone,Company,Cost,Stock")] Phone phone) { if (ModelState.IsValid) { _context.Add(phone); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(phone)); }
public async Task <IActionResult> Create([Bind("Id,Model,PhoneId,Storage,RAM")] Configration configration) { if (ModelState.IsValid) { _context.Add(configration); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(configration)); }