public ActionResult Delete(string[] ids)
        {
            try
            {
                if (ids.Length != 0)
                {
                    var contactInformations =
                        from id in ids
                        select _contactInfoService.GetById(int.Parse(id));

                    _contactInfoService.BatchDelete(contactInformations);

                    //Delete localize
                    for (var i = 0; i < ids.Length; i++)
                    {
                        var ieLocalizedProperty
                            = _localizedPropertyService.GetByEntityId(int.Parse(ids[i]));
                        _localizedPropertyService.BatchDelete(ieLocalizedProperty);
                    }
                }
            }
            catch (Exception exception1)
            {
                var exception = exception1;
                LogText.Log(string.Concat("ContactInfor.Delete: ", exception.Message));
            }
            return(RedirectToAction("Index"));
        }
        // GET: ContactViewModels/Details/5
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var contactViewModel = _contactInfoService.GetById(id.Value);

            if (contactViewModel == null)
            {
                return(NotFound());
            }

            return(View(contactViewModel));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> GetById(ContactInfoByIdInput model)
        {
            var optresult = await _contactService.GetById(model.Id);

            var outresult = _mapper.Map <ContactInfoOutput>(optresult);
            //outresult.WeChat = Convert.ToBase64String(optresult.WeChat);
            var result = ApiResultBase.GetInstance(ResultCode.Access, result: outresult);

            return(Ok(result));
        }