Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ConfigrationId,DefectInPhone,IsRepairable,RepairDate")] Repair repair)
        {
            if (id != repair.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(repair);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RepairExists(repair.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(repair));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("PhoneId,NameOfPhone,Company,Cost,Stock")] Phone phone)
        {
            if (id != phone.PhoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(phone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PhoneExists(phone.PhoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(phone));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Model,PhoneId,Storage,RAM")] Configration configration)
        {
            if (id != configration.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(configration);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConfigrationExists(configration.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(configration));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, Contacts contacts)
        {
            if (id != contacts.ID)
            {
                return(NotFound("İletişim Bilgisi Bulunamadı!"));
            }

            try
            {
                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.Update(contacts);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ContactsExists(contacts.ID))
                {
                    return(NotFound("İletişim Bilgisi Bulunamadı!"));
                }
                else
                {
                    throw;
                }
            }
            return(Ok(contacts));
        }