コード例 #1
0
        public Guarantor UpdateGuarantor(Guarantor guarantorChanges)
        {
            var guarantor = context.Guarantors.Attach(guarantorChanges);

            guarantor.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            context.SaveChanges();
            return(guarantorChanges);
        }
コード例 #2
0
        public Guarantor DeleteGuarantor(int id)
        {
            Guarantor guarantor = context.Guarantors.Find(id);

            if (guarantor != null)
            {
                context.Guarantors.Remove(guarantor);
                context.SaveChanges();
            }
            return(guarantor);
        }
コード例 #3
0
        //---------------------------------------Guarantor----------------------------------------------------

        public Guarantor AddGuarantor(Guarantor guarantor)
        {
            context.Add(guarantor);
            context.SaveChanges();
            return(guarantor);
        }