Ejemplo n.º 1
0
 public static void ToEntity(DT.Problem source, DA.Problem target, DA.OKBDataContext okb)
 {
     if ((source != null) && (target != null))
     {
         target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.ProblemClassId = source.ProblemClassId; target.DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb);
     }
 }
        public void UpdateProblem(DataTransfer.Problem dto)
        {
            roleVerifier.AuthenticateForAllRoles(OKBRoles.OKBAdministrator);

            using (OKBDataContext okb = new OKBDataContext()) {
                DataAccess.Problem entity = okb.Problems.FirstOrDefault(x => x.Id == dto.Id);
                Convert.ToEntity(dto, entity, okb);
                okb.SubmitChanges();
            }
        }
Ejemplo n.º 3
0
 public static DA.Problem ToEntity(DT.Problem source, DA.OKBDataContext okb)
 {
     if (source == null)
     {
         return(null);
     }
     return(new DA.Problem {
         Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId, DataType = Convert.ToEntity(source.DataTypeName, source.DataTypeTypeName, okb)
     });
 }
        public long AddProblem(DataTransfer.Problem dto)
        {
            roleVerifier.AuthenticateForAllRoles(OKBRoles.OKBAdministrator);

            using (OKBDataContext okb = new OKBDataContext()) {
                DataAccess.Problem entity = Convert.ToEntity(dto, okb); entity.Id = 0;
                okb.Problems.InsertOnSubmit(entity);
                okb.SubmitChanges();
                return(entity.Id);
            }
        }