Example #1
0
        public SmcModel GetById(Guid id)
        {
            SmcModel smcModel = this._iogContext.SmcModels
                                .Include(smcModelIterator => smcModelIterator.Manufacturer)
                                .FirstOrDefault(smcModelIterator =>
                                                smcModelIterator.Id == id && smcModelIterator.Active);

            return(smcModel);
        }
Example #2
0
        public SmcModel GetByName(string name)
        {
            SmcModel smcModel = this._iogContext.SmcModels
                                .Include(smcModelIterator => smcModelIterator.Manufacturer)
                                .Include(smcModelIterator => smcModelIterator.Smcs)
                                .FirstOrDefault(smcModelIterator =>
                                                smcModelIterator.Name == name && smcModelIterator.Active);

            if (smcModel != null)
            {
                smcModel.Smcs = smcModel.Smcs.Where(smc => smc.Active).ToList();
            }

            return(smcModel);
        }
Example #3
0
 public SmcModel Update(SmcModel smcModel)
 {
     this._iogContext.Update(smcModel);
     this._iogContext.SaveChanges();
     return(smcModel);
 }
Example #4
0
 public SmcModel Save(SmcModel smcModel)
 {
     this._iogContext.SmcModels.Add(smcModel);
     this._iogContext.SaveChanges();
     return(smcModel);
 }