public IActionResult Get(int id)
        {
            var result = habitService.GetHabit(id);
            IEnumerable <int> repeatArrayInt = null;

            if (result.RepeatDays != null)
            {
                var repeatArray = habitService.GetFlags(result.RepeatDays);
                repeatArrayInt = repeatArray.Select(x => Convert.ToInt32(x));
            }

            HabitModel habitModel = new HabitModel
            {
                Id                     = result.Id,
                Name                   = result.Name,
                Description            = result.Description,
                StartDate              = result.StartDate,
                EndDate                = result.EndDate,
                Repeat                 = result.Repeat,
                RepeatDays             = repeatArrayInt,
                Colour                 = result.Colour,
                Mesurable              = result.Mesurable,
                NumberOfBlocks         = result.NumberOfBlocks,
                RepresentationOfBlocks = result.RepresentationOfBlocks
            };

            return(Ok(habitModel));
        }
Esempio n. 2
0
        public IHttpActionResult Get(int habitID)
        {
            var response = service.GetHabit(habitID);

            return(Ok(response));
        }