internal static NodeDto MapToNode(NodeRow pNodeRow, PlatformDto pPlatform) { if (pNodeRow == null) { return(null); } NodeDto _node = new NodeDto(); _node.NodeId = pNodeRow.Node_id; _node.BillingExportFrequency = pNodeRow.Billing_export_frequency; _node.CdrPublishingFrequency = pNodeRow.Cdr_publishing_frequency; _node.Description = pNodeRow.Description; _node.IpAddress = pNodeRow.Ip_address; _node.NodeRole = pNodeRow.NodeRole; _node.Password = pNodeRow.Password; _node.Port = pNodeRow.Port; _node.Status = (Status)pNodeRow.Status; _node.TransportType = (TransportType)pNodeRow.Transport_type; _node.UserName = pNodeRow.User_name; _node.Platform = pPlatform; return(_node); }
public void Update(PlatformDto platformDto) { var platform = MapDtoToDomain(platformDto); _unitOfWork.PlatformRepository.Update(platform); _unitOfWork.Save(); }
private static Platform NewPlatformFromDto(PlatformDto dto) { return(new Platform { PlatformId = dto.platform_id, Name = dto.name, Slug = dto.slug, Manufacturer = dto.manufacturer, Generation = dto.generation, Discontinued = dto.discontinued, IntroductoryPrice = dto.introductory_price, UnitsSold = dto.units_sold, Media = dto.media, Type = dto.platform_type, Cpu = dto.cpu, Memory = dto.memory, Display = dto.display, Release = new PlatformRelease { Europe = dto.released_eu, NorthAmerica = dto.released_na, Japan = dto.released_jp } }); }
public async Task <ActionResult <Platform> > PostPlatform(PlatformDto platformDto) { var platform = _mapper.Map(platformDto, new Platform()); _context.Platforms.Add(platform); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPlatform", new { id = platform.Id }, platform)); }
private static PlatformDto CreatePlatformDto() { var dto = new PlatformDto { Id = "1", Name = "Name" }; return(dto); }
private static PlatformDto CreateTestPlatformDto(string name, string id = "1") { var platformDto = new PlatformDto { Id = id, Name = name }; return(platformDto); }
private PlatformDto MapDomainToDto(Platform platform) { var PlatformDto = new PlatformDto { Id = platform.Id, PlatformName = platform.PlatformName, ICType = platform.ICType, }; return(PlatformDto); }
private Platform MapDtoToDomain(PlatformDto platformDto) { var PlatformDomain = new Platform { Id = platformDto.Id, PlatformName = platformDto.PlatformName, ICType = platformDto.ICType, }; return(PlatformDomain); }
public async Task UpdateAsync(PlatformDto platformDto) { if (platformDto == null) { throw new InvalidServiceOperationException("Is null platform dto"); } await ValidatePlatformNameAsync(platformDto.Id, platformDto.Name); var platform = _mapper.Map <Platform>(platformDto); await _platformRepository.UpdateAsync(platform); await _unitOfWork.CommitAsync(); }
internal static PlatformDto MapToPlatform(PlatformRow pPlatformRow) { if (pPlatformRow == null) { return(null); } PlatformDto _platform = new PlatformDto(); _platform.PlatformId = pPlatformRow.Platform_id; _platform.Location = pPlatformRow.Location; _platform.Status = (Status)pPlatformRow.Status; _platform.PlatformConfig = pPlatformRow.PlatformConfiguration; return(_platform); }
internal static PlatformRow MapToPlatformRow(PlatformDto pPlatform) { if (pPlatform == null) { return(null); } PlatformRow _platformRow = new PlatformRow(); _platformRow.Platform_id = pPlatform.PlatformId; _platformRow.Location = pPlatform.Location; _platformRow.Status = (byte)pPlatform.Status; _platformRow.PlatformConfiguration = pPlatform.PlatformConfig; return(_platformRow); }
public static void UpdatePlatform(PlatformDto pPlatform, out Result pResult) { pResult = new Result(); using (var _db = new Rbr_Db()) { _db.BeginTransaction(); try { if (PlatformManager.IsLocationInUse(_db, pPlatform.Location, pPlatform.PlatformId)) { throw new Exception("Platform with the same name already exists."); } var _platformRow = MapToPlatformRow(pPlatform); PlatformManager.UpdatePlatform(_db, _platformRow); _db.CommitTransaction(); } catch (Exception _ex) { _db.RollbackTransaction(); pResult.Success = false; pResult.ErrorMessage = _ex.Message; TimokLogger.Instance.LogRbr(LogSeverity.Critical, "PlatformController.UpdatePlatform", string.Format("Exception:\r\n{0}", _ex)); } } }
public static void DeletePlatform(PlatformDto pPlatform, out Result pResult) { pResult = new Result(); using (var _db = new Rbr_Db()) { _db.BeginTransaction(); try { var _currNode = PlatformManager.GetNode(_db, CurrentPlatformNode.Id); if (_currNode.Platform_id == pPlatform.PlatformId) { throw new Exception("Cannot delete Current Platform."); } var _platformRow = MapToPlatformRow(pPlatform); PlatformManager.DeletePlatform(_db, _platformRow); _db.CommitTransaction(); } catch (Exception _ex) { _db.RollbackTransaction(); pResult.Success = false; pResult.ErrorMessage = _ex.Message; TimokLogger.Instance.LogRbr(LogSeverity.Critical, "PlatformController.DeletePlatform", string.Format("Exception:\r\n{0}", _ex)); } } }
/// <summary> /// function for Saving data /// </summary> public IActionResult Save(PlatformDto platformDto) { _platformService.Update(platformDto); return(RedirectToAction(nameof(Index))); }
public IActionResult Add(PlatformDto PlatformDto) { _platformService.Add(PlatformDto); return(RedirectToAction(nameof(Index))); }