/// <summary> /// /// </summary> /// <param name="Space"></param> /// <returns></returns> public bool DeleteSpace(SpaceDTO Space) { var result = false; TblSpace space = _mapper.Map <TblSpace>(Space); result = _spaceRepository.DeleteSpace(space); return(result); }
/// <summary> /// /// </summary> /// <param name="SpaceID"></param> /// <returns></returns> public SpaceDTO GetSpaceByID(string SpaceID) { TblSpace tblspace = new TblSpace(); tblspace = _spaceRepository.GetSpaceByID(SpaceID); SpaceDTO spacedto = new SpaceDTO(); spacedto = _mapper.Map <SpaceDTO>(tblspace); return(spacedto); }
public bool DeleteSpace(SpaceDTO space) { try { return(_spaceService.DeleteSpace(space)); } catch (Exception ex) { return(false); } }
/// <summary> /// /// </summary> /// <param name="Space"></param> /// <returns></returns> public SpaceDTO UpdateSpace(SpaceDTO Space) { TblSpace space = _mapper.Map <TblSpace>(Space); space = _spaceRepository.UpdateSpace(space); SpaceDTO spacedto = new SpaceDTO(); spacedto = _mapper.Map <SpaceDTO>(space); return(spacedto); }
public bool CreateSpace(SpaceDTO space) { try { return(_spaceService.CreateSpace(space)); } catch (Exception ex) { //log } return(false); }
/// <summary> /// /// </summary> /// <param name="Space"></param> /// <returns></returns> public SpaceDTO CreateSpace(SpaceDTO Space) { TblSpace space = _mapper.Map <TblSpace>(Space); space.SpaceId = Guid.NewGuid().ToString(); space.CreatedDate = DateTime.Now; space = _spaceRepository.CreateSpace(space); SpaceDTO spacedto = _mapper.Map <SpaceDTO>(space); return(spacedto); }
public async Task <IActionResult> CreateSpace([FromBody] SpaceDTO spaceDTO) { var spaceToCreate = _mapper.Map <Space>(spaceDTO); if (spaceToCreate == null) { return(BadRequest("Space cannot be null")); } if (await _lineUpRepository.EntityExists(spaceToCreate)) { return(BadRequest("Space has already been created")); } spaceToCreate.DateCreated = DateTime.Now; _lineUpRepository.Add(spaceToCreate); await _lineUpRepository.SaveAllChanges(); return(Ok()); }
public APIResponse UpdateSpace(SpaceDTO space) { try { return(new APIResponse { returnCode = 0, returnMessage = "Success", returnObject = _spaceService.UpdateSpace(space) }); } catch (Exception ex) { return(new APIResponse { returnCode = -1, returnMessage = ex.Message.ToString() }); } }
public async Task <IActionResult> UpdateSpace(int spaceId, [FromBody] SpaceDTO spaceDTO) { var space = await _lineUpRepository.GetSpace(spaceId); // _lineUpRepository.Delete(space.Amenities); var spaceToUpdate = _mapper.Map <SpaceDTO, Space>(spaceDTO, space); if (spaceToUpdate == null) { return(BadRequest("Space cannot be null")); } if (await _lineUpRepository.EntityExists(spaceToUpdate)) { // spaceToUpdate.Amenities.Entr _lineUpRepository.Update(spaceToUpdate); await _lineUpRepository.SaveAllChanges(); return(Ok()); } return(BadRequest()); }
public static SpaceDTO GetSpaceDTO(Core.Entities.Space entity) { var dto = new SpaceDTO { Id = entity.Id, Name = entity.Name, Slug = entity.Slug, Description = entity.Description, CreatedAt = entity.CreatedAt, CreatedBy = entity.CreatedBy, UpdatedAt = entity.UpdatedAt, UpdatedBy = entity.UpdatedBy, Owner = GetAppUserLightDTO(entity.Owner), }; dto.Pages = new List <PageLightDTO>(); foreach (var page in entity.GetPages()) { dto.Pages.Add(GetPageLightDTO(page)); } return(dto); }
/// <summary> /// /// </summary> /// <param name="Space"></param> /// <returns></returns> public bool CreateSpace(SpaceDTO Space) { TblSpace space = _mapper.Map <TblSpace>(Space); return(_spaceRepository.CreateSpace(space)); }