public void DeleteSalesExecutive(int id) { SalesExecutive _salesExecutive = _salesExecutiveRepository.GetById(id); _salesExecutiveRepository.Delete(_salesExecutive); _salesExecutiveRepository.SaveChanges(); }
public SalesExecutive AddorUpdate(SalesExecutive salesExecutive) { _salesExecutiveRepository.AddOrUpdate(salesExecutive); _salesExecutiveRepository.SaveChanges(); return(salesExecutive); }
public int UpdateSalesExecutive(SalesExecutive objSalesExecutive) { using (IDbConnection connection = OpenConnection(dataConnection)) { string sql = @"Update SalesExecutive Set SalesExecutiveName=@SalesExecutiveName OUTPUT INSERTED.SalesExecutiveId WHERE SalesExecutiveId=@SalesExecutiveId"; var id = connection.Execute(sql, objSalesExecutive); return(id); } }
public int InsertSalesExecutive(SalesExecutive objSalesExecutive) { using (IDbConnection connection = OpenConnection(dataConnection)) { string sql = @"INSERT INTO SalesExecutive (SalesExecutiveName,CreatedBy,CreatedDate,OrganizationId) VALUES(@SalesExecutiveName,@CreatedBy,@CreatedDate,@OrganizationId); SELECT CAST(SCOPE_IDENTITY() as int)"; var id = connection.Query <int>(sql, objSalesExecutive).Single(); return(id); } }
public Object GetSalesExecutiveById(int executiveId) { SalesExecutive salesExecutive = _salesExecutiveRepository.Single(a => a.ExecutiveId == executiveId); if (salesExecutive != null) { return(new { SalesExecutive = new { data = salesExecutive, total = 1 } }); } else { return(null); } }
static void Main(string[] args) { Employee Jack = new Employee(); Jack.SetFullName("Jack Jackson"); Jack.SetSalary(300000); //Employee Jack = new Employee("Jack Jackson", 300000); //inherited classes ITExecutives Jill = new ITExecutives(); Jill.SetFullName("Jill White"); Jill.SetSalary(400000); // SalesExecutive John = new SalesExecutive(); //wont work since no parameterless ctor exists SalesExecutive John = new SalesExecutive("John Parker", 300000, 120); John.Sales = 20; EmployeeInfo(Jack); EmployeeInfo(Jill); EmployeeInfo(John); /////////////////////////// //LivingBeing x = new LivingBeing(); Humans human = new Humans(); Cow cow = new Cow(); Cat cat = new Cat(); French frman = new French(); Spanish spman = new Spanish(); List <LivingBeing> livingBeings = new List <LivingBeing>(); livingBeings.Add(human); livingBeings.Add(cat); livingBeings.Add(cow); livingBeings.Add(frman); livingBeings.Add(spman); Talk(livingBeings); /////////// //casting Car Nissan = new Car { RegNos = 122, TopSpeed = 120 }; Car Audi = new Car { RegNos = 221, TopSpeed = 170 }; Truck Tata = new Truck { RegNos = 1011, IsLoaded = false, NoOfTyres = 10 }; Truck Mazda = new Truck { RegNos = 50501, IsLoaded = true, NoOfTyres = 8 }; List <Vehicle> vehicles = new List <Vehicle> { Nissan, Audi, Tata, Mazda }; VehicleGarrage(vehicles); Console.ReadKey(); }