Example #1
0
 /// <summary>
 /// insert entry
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="entity"></param>
 public bool Insert <T>(T entity) where T : class
 {
     if (entity == null)
     {
         return(false);
     }
     _context.Entry(entity).State = EntityState.Added;
     //context.Set<T>().Add(entity);
     _context.SaveChanges();
     return(true);
 }
Example #2
0
 public void UpdateOQCCheck(tbl_test_log production, string operatorCode)
 {
     if (production != null)
     {
         production.QA_Check  = true;
         production.CheckBy   = operatorCode;
         production.DateCheck = DateTime.Now;
         try
         {
             _context.Entry(production).State = EntityState.Modified;
             _context.SaveChanges();
         }
         catch (Exception ex)
         {
             throw new Exception(ex.Message);
         }
     }
 }
Example #3
0
        /// <summary>
        /// Thêm mới Model
        /// </summary>
        /// <param name="modelId"></param>
        /// <param name="modelName"></param>
        /// <param name="createdBy"></param>
        /// <param name="quantity"></param>
        /// <param name="serialNo"></param>
        public void InsertModel(string modelName, string createdBy, int quantity, string serialNo)
        {
            var model = new Model()
            {
                ModelID     = Guid.NewGuid().ToString(),
                ModelName   = modelName,
                CreatedBy   = createdBy,
                DateCreated = DateTime.Now,
                Quantity    = quantity,
                SerialNo    = serialNo,
            };

            try
            {
                _context.Models.Add(model);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }