コード例 #1
0
 public bool DeleteDocumentByID(int documentID)
 {
     try
     {
         _dbContext.DocumentMasters.Remove(_dbContext.DocumentMasters.Where(_ => _.DocumentId == documentID).FirstOrDefault());
         _dbContext.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #2
0
        public void AddParticular(ParticularDto particular)
        {
            Particular parti = new Particular();

            if (particular.Id > 0)
            {
                parti = _dbContext.Particulars.Where(_ => _.Id == particular.Id).FirstOrDefault();
                parti.ParticularFF = particular.ParticularFF;
                parti.ParticularSF = particular.ParticularSF;
                parti.IsExclude    = particular.IsExclude;
                parti.UpdatedDate  = DateTime.Now;
            }
            else
            {
                parti.ParticularFF = particular.ParticularFF;
                parti.ParticularSF = particular.ParticularSF;
                parti.IsExclude    = particular.IsExclude;
                parti.CreatedDate  = DateTime.Now;
                parti.UpdatedDate  = DateTime.Now;
                _dbContext.Particulars.Add(parti);
            }
            _dbContext.SaveChanges();
        }