public async Task <ActionResult> PostLocation(CreateLocationDTO image)
        {
            var id = await locationsService.PostLocation(mapper.Map <Location>(image));


            return(CreatedAtAction("PostLocation", new { id = id }, id));
        }
Beispiel #2
0
        public async Task CreateLocation(CreateLocationDTO input)
        {
            var location = _mapper.Map <Location>(input);

            location.Project = await _projectRepository.GetById(input.ProjectId);

            location.User = await _userRepository.GetById(input.UserId);

            await _repository.Create(location);
        }
Beispiel #3
0
        public async Task <IActionResult> CreateLocation(CreateLocationDTO input)
        {
            try
            {
                await _locationService.CreateLocation(input);

                return(Ok("The process is success"));
            }
            catch (Exception)
            {
                return(BadRequest("An error occurred during the creating process. Please try again !"));
            }
        }
        public async Task <IActionResult> Create(CreateLocationViewModel input)
        {
            try
            {
                string url = await _blobManager.UploadImageAsBlob(input.Photo);

                CreateLocationDTO data = new CreateLocationDTO()
                {
                    Name      = input.Name,
                    PhotoURL  = url,
                    ProjectId = input.ProjectId,
                    Latitude  = input.Latitude,
                    Longitude = input.Longitude,
                    UserId    = input.UserId
                };
                await _locationService.CreateLocation(data);

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }