Exemple #1
0
 /// <summary>
 /// Get item
 /// </summary>
 /// <param name="model"></param>
 /// <returns>CheckListGruopModel. Throw exception if not found or get some error</returns>
 public CheckListGroupModel GetItemByID(CheckListGroupModel model)
 {
     try
     {
         using (var context = new TDHEntities())
         {
             WK_CHECKLIST_GROUP _md = context.WK_CHECKLIST_GROUP.FirstOrDefault(m => m.id == model.ID && !m.deleted);
             if (_md == null)
             {
                 throw new DataAccessException(FILE_NAME, "GetItemByID", model.CreateBy);
             }
             return(new CheckListGroupModel()
             {
                 ID = _md.id,
                 title = _md.title,
                 CreateDate = _md.create_date
             });
         }
     }
     catch (DataAccessException fieldEx)
     {
         throw fieldEx;
     }
     catch (Exception ex)
     {
         throw new ServiceException(FILE_NAME, "GetItemByID", model.CreateBy, ex);
     }
 }