public static ManagerLog Parse(ManagerLogDto mld, Manager manager) { return(new ManagerLog { ManagerId = manager.Id, TimeStamp = mld.TimeStamp, Type = mld.Type, Message = mld.Message }); }
public async Task <IEnumerable <ManagerLog> > GetAsync(ManagerUser managerUser, string type, DateTime from, DateTime to) { var host = GetHost(managerUser); try { var result = await _httpClinet.GetStringAsync($"http://{host}:{managerUser.Manager.Port}/{controller}/{managerUser.Name}/{managerUser.Token}/{type}/{from.ToLongDateString()}/{to.ToLongDateString()}"); var managerlogs = ManagerLogDto.FromJsonCollection(result); return(managerlogs.Select(m => ManagerLog.Parse(m, managerUser.Manager)).ToList()); } catch (HttpRequestException ex) { return(null); } }