示例#1
0
        public ActionResult Delete(int phoneId)
        {
            Phone deletedPhone = repository.DeletePhone(phoneId);

            if (deletedPhone != null)
            {
                TempData["message"] = string.Format("Товар \"{0} {1}\" был удален", deletedPhone.Mark, deletedPhone.Model);
            }
            return(RedirectToAction("Index"));
        }
示例#2
0
        public async Task <IActionResult> DeletePerson(string id)
        {
            var exist = await _person.PersonExist(id);


            if (!exist)
            {
                return(BadRequest("Person not on the database"));
            }


            var person = await _person.FindPerson(id);

            await _person.DeletePerson(id);

            var phoneList = await _phone.FindAllUserNumber(id);

            var emailList = await _email.FindAllUserEmails(id);

            var userEmail = User.FindFirst(System.Security.Claims.ClaimTypes.Email).Value;


            foreach (var item in phoneList)
            {
                await _phone.DeletePhone(item.Number);

                await _log.Create(userEmail, item.Number, "", $"DELETED - {person.Name} ");
            }

            foreach (var item in emailList)
            {
                await _email.DeleteEmail(item.UserEmail);

                await _log.Create(userEmail, "", item.UserEmail, $"DELETED - {person.Name} ");
            }



            return(Ok());
        }
示例#3
0
        public async Task <IActionResult> DeletePhone(string number)
        {
            var exist = await _phone.PhoneExist(number);


            if (!exist)
            {
                return(BadRequest("Phone not on the database"));
            }

            var phoneFound = await _phone.FindPhone(number);

            var person = await _person.FindPerson(phoneFound.PersonID);

            await _phone.DeletePhone(number);

            var userEmail = User.FindFirst(System.Security.Claims.ClaimTypes.Email).Value;

            await _log.Create(userEmail, number, "", $"PHONE DELETED - {person.Name} ");


            return(Ok());
        }
示例#4
0
        public async Task <IActionResult> DeletePhone(int?phoneId)
        {
            int result = 0;

            if (phoneId == null)
            {
                return(BadRequest());
            }

            try
            {
                result = await phoneRepository.DeletePhone(phoneId);

                if (result == 0)
                {
                    return(NotFound());
                }
                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
示例#5
0
 public bool DeletePhone(Guid Id) => phoneRepository.DeletePhone(Id);
示例#6
0
 public async Task DeletePhone(int phoneId)
 {
     await _repository.DeletePhone(phoneId);
 }