public async Task <ActionResult <LocationLog_LocationLogDTO> > Create([FromBody] LocationLog_LocationLogDTO LocationLog_LocationLogDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(LocationLog_LocationLogDTO.Id))
            {
                return(Forbid());
            }

            LocationLog LocationLog = ConvertDTOToEntity(LocationLog_LocationLogDTO);

            LocationLog = await LocationLogService.Create(LocationLog);

            LocationLog_LocationLogDTO = new LocationLog_LocationLogDTO(LocationLog);
            if (LocationLog.IsValidated)
            {
                return(LocationLog_LocationLogDTO);
            }
            else
            {
                return(BadRequest(LocationLog_LocationLogDTO));
            }
        }
        private LocationLog ConvertDTOToEntity(LocationLog_LocationLogDTO LocationLog_LocationLogDTO)
        {
            LocationLog LocationLog = new LocationLog();

            LocationLog.Id             = LocationLog_LocationLogDTO.Id;
            LocationLog.PreviousId     = LocationLog_LocationLogDTO.PreviousId;
            LocationLog.AppUserId      = LocationLog_LocationLogDTO.AppUserId;
            LocationLog.Latitude       = LocationLog_LocationLogDTO.Latitude;
            LocationLog.Longtitude     = LocationLog_LocationLogDTO.Longtitude;
            LocationLog.UpdateInterval = LocationLog_LocationLogDTO.UpdateInterval;
            LocationLog.AppUser        = LocationLog_LocationLogDTO.AppUser == null ? null : new AppUser
            {
                Id          = LocationLog_LocationLogDTO.AppUser.Id,
                Username    = LocationLog_LocationLogDTO.AppUser.Username,
                Password    = LocationLog_LocationLogDTO.AppUser.Password,
                DisplayName = LocationLog_LocationLogDTO.AppUser.DisplayName,
                Email       = LocationLog_LocationLogDTO.AppUser.Email,
                Phone       = LocationLog_LocationLogDTO.AppUser.Phone,
            };
            LocationLog.Previous = LocationLog_LocationLogDTO.Previous == null ? null : new LocationLog
            {
                Id             = LocationLog_LocationLogDTO.Previous.Id,
                PreviousId     = LocationLog_LocationLogDTO.Previous.PreviousId,
                AppUserId      = LocationLog_LocationLogDTO.Previous.AppUserId,
                Latitude       = LocationLog_LocationLogDTO.Previous.Latitude,
                Longtitude     = LocationLog_LocationLogDTO.Previous.Longtitude,
                UpdateInterval = LocationLog_LocationLogDTO.Previous.UpdateInterval,
            };
            LocationLog.BaseLanguage = CurrentContext.Language;
            return(LocationLog);
        }
        public async Task <ActionResult <LocationLog_LocationLogDTO> > Get([FromBody] LocationLog_LocationLogDTO LocationLog_LocationLogDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(LocationLog_LocationLogDTO.Id))
            {
                return(Forbid());
            }

            LocationLog LocationLog = await LocationLogService.Get(LocationLog_LocationLogDTO.Id);

            return(new LocationLog_LocationLogDTO(LocationLog));
        }