public async Task <IHttpActionResult> GetMasterData() { MasterDataDto result = new MasterDataDto { MasterData = new MasterDataResult() }; result.MasterData.Towns = _service.GetAllTowns(); result.MasterData.ListingTypes = _service.GetAllEstate_Types(); result.MasterData.SaleUnits = _service.GetAllSaleUnits(); result.MasterData.RentUnits = _service.GetAllRentUnits(); return(Ok(RealEstateResponse <MasterDataDto> .Create(result))); }
public void AddMasterdata(EpcisMasterData masterdata) { MasterDataDtos.Add(MasterDataDto.Create(masterdata)); foreach (var attribute in masterdata.Attributes) { var attributeDto = MasterDataAttributeDto.Create(attribute, masterdata.Id, masterdata.Type); AttributeDtos.Add(attributeDto); FieldDtos.AddRange(attribute.Fields.ToFlattenedDtos(attributeDto)); } HierarchyDtos.AddRange(masterdata.Children.Select(x => MasterDataHierarchyDto.Create(x, masterdata.Id, masterdata.Type))); }
public IHttpActionResult CreateAuditTrail(MasterDataDto masterDataDto) { if (!ModelState.IsValid) { return(BadRequest()); } var masterdata = Mapper.Map <MasterDataDto, MasterData>(masterDataDto); _context.MasterDatas.Add(masterdata); _context.SaveChanges(); masterDataDto.Id = masterdata.Id; return(Created(new Uri(Request.RequestUri + "/" + masterdata.Id), masterDataDto)); }
public IHttpActionResult UpdateMasterData(int id, MasterDataDto masterDataDto) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var masterData = _context.AuditTrails.SingleOrDefault(a => a.Id == id); if (masterData == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } Mapper.Map(masterDataDto, masterData); _context.SaveChanges(); return(Ok("Information has been updated!")); }