예제 #1
0
 public static Source GetEntSourceFromDtoSource(Common.Data.Models.SourceDto dtoSource)
 {
     return(new Source
     {
         Id = dtoSource.Id,
         Name = dtoSource.Name,
         HexColor = dtoSource.HexColor,
         DefaultWidth = dtoSource.DefaultWidth,
         DefaultHeight = dtoSource.DefaultHeight
     });
 }
예제 #2
0
        public int AddSource(Common.Data.Models.SourceDto newSource)
        {
            using (var context = new ExodusPrototype1Entities())
            {
                var newSourceEnt = SourceMapper.GetEntSourceFromDtoSource(newSource);
                context.Sources.Add(newSourceEnt);
                context.SaveChanges();
                Clients.All.SourceAdded(SourceMapper.GetDtoSourceFromEntSource(newSourceEnt));

                this.WriteToWindowConsole($"Client: {Context.ConnectionId} - Added Source With Id: {newSourceEnt.Id} and Name: {newSourceEnt.Name}");

                return(newSourceEnt.Id);
            }
        }
예제 #3
0
 public static DcSource GetDcSourceFromDtoSource(Common.Data.Models.SourceDto dtoSource)
 {
     return(new DcSource(dtoSource.Name, dtoSource.DefaultWidth, dtoSource.DefaultHeight, dtoSource.HexColor, dtoSource.Id));
 }