Example #1
0
        public ActionResult <BaseViewModel <LocationViewModel> > PostLocation(CreateLocationRequestViewModel location)
        {
            var result = _locationService.CreateLocation(location);

            this.HttpContext.Response.StatusCode = (int)result.StatusCode;

            return(result);
        }
Example #2
0
        public BaseViewModel <LocationViewModel> CreateLocation(CreateLocationRequestViewModel location)
        {
            var entity = _mapper.Map <Location>(location);

            entity.Id = Guid.NewGuid();
            entity.SetDefaultInsertValue(_repository.GetUsername());
            _repository.Add(entity);

            var result = new BaseViewModel <LocationViewModel>()
            {
                Data = _mapper.Map <LocationViewModel>(entity),
            };

            Save();

            return(result);
        }