Example #1
0
        public async Task <IActionResult> AddContactPhone(Contact contact, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                byte num = 0;
                if (!string.IsNullOrEmpty(contact.Address))
                {
                    num++;
                }
                if (!string.IsNullOrEmpty(contact.Email))
                {
                    num++;
                }
                if (!string.IsNullOrEmpty(contact.PhoneNumber))
                {
                    num++;
                }
                if (!string.IsNullOrEmpty(contact.MobileNumber))
                {
                    num++;
                }
                if (num == 1)
                {
                    contact.LastModifiedByName = User.Identity.Name;
                    await _repository.AddContactAsync(contact);
                }
            }

            return(LocalRedirect(returnUrl));
        }