Example #1
0
        public IActionResult DeleteAddress(string id)
        {
            var address = _receiversService.DeleteAddress(id);

            var receiverId = address.ReceiverId;

            return(this.Redirect($"/Receivers/Edit?id={receiverId}"));
        }
Example #2
0
        public void DeleteAddress_works_Properly()
        {
            string errorMessagePrefix = "ReceiverService DeleteAddress() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.receiverService = new ReceiverService(context);

            var address = new DeliveryAddress()
            {
                Town = "Town1",
            };

            context.DeliveryAddresses.Add(address);
            context.SaveChanges();

            var result = receiverService.DeleteAddress(address.Id);

            Assert.True(result.isDeleted);
        }