Example #1
0
        /// <summary>
        /// Update VacationPolicy
        /// </summary>
        /// <param name="vacationPolicy">Object VacationPolicyModel</param>
        /// <returns></returns>
        public bool Update(VacationPolicyModel vacationPolicy)
        {
            if (vacationPolicy == null)
            {
                throw new ArgumentNullException("vacationPolicy");
            }

            using (var dataContext = new Database(DbName))
            {
                dataContext.Update(vacationPolicy);
                return(true);
            }
        }
Example #2
0
        /// <summary>
        /// Add VacationPolicy
        /// </summary>
        /// <param name="vacationPolicy">Object VacationPolicyModel</param>
        /// <returns>Return the employee ID inserted, an error text if something wrong happens</returns>
        public string Add(VacationPolicyModel vacationPolicy)
        {
            if (vacationPolicy == null)
            {
                throw new ArgumentNullException("vacationPolicy");
            }

            using (var dataContext = new Database(DbName))
            {
                dataContext.Insert(vacationPolicy);
                return(vacationPolicy.Id.ToString());
            }
        }
Example #3
0
        /// <summary>
        /// Delete an Employee
        /// </summary>
        /// <param name="id">Employee ID</param>
        /// <returns>Return an error text if something wrong happens</returns>
        public bool Delete(int id)
        {
            if (id < 1)
            {
                throw new ArgumentException("id");
            }

            var model = new VacationPolicyModel()
            {
                Id = id
            };

            using (var dataContext = new Database(DbName))
            {
                dataContext.Delete(model);
                return(true);
            }
        }