Esempio n. 1
0
        public IActionResult Get([FromHeader] string authorization)
        {
            UserReadDbo user = _auth.ValidateUser(authorization);

            if (user == null)
            {
                return(_auth.GetError());
            }

            IEnumerable <Contact> ret = _repo.GetContacts(user.Id).Select(item => new Contact
            {
                Id              = item.Id,
                Name            = item.Name,
                Description     = item.Description,
                Birthdate       = item.Birthdate?.ToString("yyyy-MM-dd"),
                PrettyBirthdate = item.Birthdate?.ToString("MMMM dd, yyyy"),

                CreatedAt = item.CreatedAt.ToLocalTime().ToString("F"),
                UpdatedAt = item.CreatedAt.ToLocalTime().ToString("F"),

                Favorite = item.Favorite,
                GroupId  = item.GroupId
            });

            return(Ok(ret));
        }