コード例 #1
0
 public bool AddCompany(CompanyDetailsVM model)
 {
     try
     {
         CompanyDetail dataModel = new CompanyDetail()
         {
             CompanyStatus   = (int)model.CompanyStatus,
             CompanyName     = model.CompanyName,
             ManagingPartner = model.ManagingPartner,
             LaunchedYear    = model.LaunchedYear,
             Stage           = (int)model.Stage,
             NumberOfMembers = model.NumberOfMembers,
             WebSite         = model.WebSite,
             Email           = model.Email,
             Phone           = model.Phone,
             Country         = model.Country,
             City            = model.City,
             Pincode         = model.Pincode,
             CreatedBy       = model.CreatedBy
         };
         using (GrowUpIncubatorEntities db = new GrowUpIncubatorEntities())
         {
             db.CompanyDetails.Add(dataModel);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #2
0
 public bool UpdateCompany(CompanyDetailsVM model)
 {
     try
     {
         CompanyDetail dbCompanyList = new CompanyDetail();
         using (GrowUpIncubatorEntities db = new GrowUpIncubatorEntities())
         {
             dbCompanyList = db.CompanyDetails.Where(x => x.Id == model.Id).FirstOrDefault();
             if (dbCompanyList != null)
             {
                 dbCompanyList.Id              = dbCompanyList.Id;
                 dbCompanyList.CompanyStatus   = (int)dbCompanyList.CompanyStatus;
                 dbCompanyList.CompanyName     = dbCompanyList.CompanyName;
                 dbCompanyList.ManagingPartner = dbCompanyList.ManagingPartner;
                 dbCompanyList.LaunchedYear    = dbCompanyList.LaunchedYear;
                 dbCompanyList.Stage           = (int)dbCompanyList.Stage;
                 dbCompanyList.NumberOfMembers = dbCompanyList.NumberOfMembers;
                 dbCompanyList.WebSite         = dbCompanyList.WebSite;
                 dbCompanyList.Email           = dbCompanyList.Email;
                 dbCompanyList.Phone           = dbCompanyList.Phone;
                 dbCompanyList.Country         = dbCompanyList.Country;
                 dbCompanyList.City            = dbCompanyList.City;
                 dbCompanyList.Pincode         = dbCompanyList.Pincode;
                 db.SaveChanges();
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #3
0
        public bool DeactivateCompany(int id)
        {
            CompanyDetail dbCompanyList = new CompanyDetail();

            using (GrowUpIncubatorEntities db = new GrowUpIncubatorEntities())
            {
                dbCompanyList = db.CompanyDetails.Where(x => x.Id == id).FirstOrDefault();
                if (dbCompanyList != null)
                {
                    dbCompanyList.CompanyStatus = (int)CompanyStatusEnum.Deactivate;
                    db.SaveChanges();
                    return(true);
                }
            }
            return(false);
        }