Exemplo n.º 1
0
        public static string UpdateInsuranceCmp(InsuranceCmpList Obj)
        {
            using (var DbContext = new BSSDBEntities())
            {
                var ReqData = DbContext.Tbl_InsuranceCmpMaster.Where(x => x.InsuranceCompanyId == Obj.InsuranceCompanyId).FirstOrDefault();
                if (ReqData != null)
                {
                    ReqData.CompanyName  = Obj.CompanyName;
                    ReqData.CompanyCode  = Obj.CompanyCode;
                    ReqData.IsDeleted    = Obj.IsDeleted;
                    ReqData.ModifiedBy   = Obj.CreatedBy;
                    ReqData.AccountId    = Obj.AccountId;
                    ReqData.DealerId     = Obj.DealerId;
                    ReqData.ModifiedDate = DateTime.Now;

                    DbContext.Entry(ReqData).State = System.Data.Entity.EntityState.Modified;
                    DbContext.SaveChanges();

                    return("Updated successfully !");
                }
                else
                {
                    return("Does not exist !");
                }
            }
        }
Exemplo n.º 2
0
        public static string AddInsuranceCmp(InsuranceCmpList Obj)
        {
            using (var DbContext = new BSSDBEntities())
            {
                var ReqData = DbContext.Tbl_InsuranceCmpMaster.Where(x => x.CompanyName == Obj.CompanyName && x.CompanyCode == Obj.CompanyCode && x.DealerId == Obj.DealerId && x.AccountId == Obj.AccountId && x.IsDeleted == false).FirstOrDefault();
                if (ReqData == null)
                {
                    Tbl_InsuranceCmpMaster TIC = new Tbl_InsuranceCmpMaster {
                        CompanyName  = Obj.CompanyName,
                        CompanyCode  = Obj.CompanyCode,
                        IsDeleted    = false,
                        CreatedBy    = Obj.CreatedBy,
                        AccountId    = Obj.AccountId,
                        DealerId     = Obj.DealerId,
                        CreationDate = DateTime.Now
                    };
                    DbContext.Entry(TIC).State = System.Data.Entity.EntityState.Added;
                    DbContext.SaveChanges();

                    return("Added successfully !");
                }
                else
                {
                    return("Already exist !");
                }
            }
        }
 public string UpdateInsuranceCmp(InsuranceCmpList Obj)
 {
     return(InsuranceCmpDAL.UpdateInsuranceCmp(Obj));
 }
 public string AddInsuranceCmp(InsuranceCmpList Obj)
 {
     return(InsuranceCmpDAL.AddInsuranceCmp(Obj));
 }