Ejemplo n.º 1
0
        public async Task <ActionResult> Delete(int?id, [Bind(Include = "Id")] ContactDeleteViewModel deleteModel)
        {
            var req = new ContactDeleteRequest {
                Id = id ?? deleteModel.Id, Deleter = "FakeUserForDeletionTest"
            };

            var result = await _contactRepository.DeleteContactAsync(req);

            if (result.Success)
            {
                result.DeletedId = id.GetValueOrDefault();
                this.AddToastMessage(@Resource.Resource.Toast_Success, @Resource.Resource.DeleteContact_Toast_Success, ToastType.Success);

                return(RedirectToAction("Deleted", result));
            }

            var vm = new GenericErrorVM {
                ErrorMessage = result.Message
            };

            this.AddToastMessage(@Resource.Resource.DeleteContact_Toast_Failure, result.Message, ToastType.Success);

            Log.Error(null, result.Message);

            return(View("../GenericError/GenericError", vm));
        }
Ejemplo n.º 2
0
        public IActionResult Delete(int id)
        {
            Contact contact = _contactDabase.GetContact(id);
            ContactDeleteViewModel contactToDelete = new ContactDeleteViewModel()
            {
                Id   = id,
                Naam = contact.Voornaam + " " + contact.Naam
            };

            return(View(contactToDelete));
        }
Ejemplo n.º 3
0
        public IActionResult Delete(int id)
        {
            Contact contactFromDb = _contactDatabase.GetContact(id);

            ContactDeleteViewModel contact = new ContactDeleteViewModel()
            {
                Id       = contactFromDb.Id,
                Naam     = contactFromDb.Naam,
                Voornaam = contactFromDb.Voornaam
            };

            return(View(contact));
        }
Ejemplo n.º 4
0
        public IActionResult Delete(int id)
        {
            var contactFromDb = _contactDatabase.GetContact(id);

            var contact = new ContactDeleteViewModel()
            {
                Id        = contactFromDb.Id,
                FirstName = contactFromDb.FirstName,
                LastName  = contactFromDb.LastName,
            };

            return(View(contact));
        }
Ejemplo n.º 5
0
        public IActionResult Delete(int id)
        {
            Contact contact = _contactRepository.GetContact(id);
            ContactDeleteViewModel contactDeleteViewModel = new ContactDeleteViewModel
            {
                Id      = contact.Id,
                Name    = contact.Name,
                Email   = contact.Email,
                Subject = contact.Subject,
                Message = contact.Message,
            };

            return(View(contactDeleteViewModel));
        }
        public static ContactDeleteViewModel ConvertToDeleteViewModel(this Domain.DomainModels.Contact.Contact contact)
        {
            var returnViewModel = new ContactDeleteViewModel
            {
                Id                    = contact.Id,
                EMail                 = contact.EMail,
                FirstName             = contact.FirstName ?? "N/A",
                LastName              = contact.LastName ?? "N/A",
                TelephoneNumber_Entry = contact.TelephoneNumber_Entry ?? "N/A",
                TotalCount            = contact.TotalCount,
                CreatedUtc            = contact.CreatedUtc,
                ModifiedUtc           = contact.ModifiedUtc,
                Created               = contact.CreatedUtc.LocalDateTime,
                Modified              = contact.ModifiedUtc.GetValueOrDefault().LocalDateTime,
                CreatedBy             = contact.CreatedBy ?? "N/A",
                ModifiedBy            = contact.ModifiedBy ?? "N/A",
                Action                = contact.Action
            };

            return(returnViewModel);
        }
Ejemplo n.º 7
0
        public IActionResult Delete(ContactDeleteViewModel model)
        {
            _contactRepository.Delete(model.Id);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 8
0
        public IActionResult ConfirmDelete(ContactDeleteViewModel contact)
        {
            _contactDatabase.Delete(contact.Id);

            return(RedirectToAction("Contactenoverzicht"));
        }