public ServiceResponse <m_employee> CreateEmployee(m_employee model)
        {
            try
            {
                model.Code        = GenerateCode();
                model.IsDelete    = false;
                model.CreatedBy   = "Admin";
                model.CreatedDate = DateTime.UtcNow;

                _ctx.m_employees.Add(model);
                _ctx.SaveChanges();

                return(new ServiceResponse <m_employee>
                {
                    IsSuccess = true,
                    Time = DateTime.UtcNow,
                    Message = "Employee Created",
                    Data = model
                });
            }
            catch (Exception e)
            {
                return(new ServiceResponse <m_employee>
                {
                    IsSuccess = false,
                    Time = DateTime.UtcNow,
                    Message = e.StackTrace,
                    Data = null
                });
            }
        }
Beispiel #2
0
        public ServiceResponse <m_role> CreateRole(m_role role)
        {
            try
            {
                role.Code        = "RO" + GenCode();
                role.IsDelete    = false;
                role.CreatedBy   = "Administrator";
                role.CreatedDate = DateTime.UtcNow;
                _ctx.m_roles.Add(role);
                _ctx.SaveChanges();

                return(new ServiceResponse <m_role>
                {
                    IsSuccess = true,
                    Time = DateTime.UtcNow,
                    Message = "Role Created",
                    Data = role
                });
            }
            catch (Exception e)
            {
                return(new ServiceResponse <m_role>
                {
                    IsSuccess = false,
                    Time = DateTime.UtcNow,
                    Message = e.StackTrace,
                    Data = null
                });
            }
        }
Beispiel #3
0
        public ServiceResponse <m_company> CreateCompany(m_company company)
        {
            try
            {
                company.Code        = "CP" + GenerateCode();
                company.IsDelete    = false;
                company.CreatedBy   = "";
                company.CreatedDate = DateTime.UtcNow;

                _ctx.m_companies.Add(company);
                _ctx.SaveChanges();

                return(new ServiceResponse <m_company>
                {
                    IsSuccess = true,
                    Time = DateTime.UtcNow,
                    Message = "Company Created",
                    Data = company
                });
            }
            catch (Exception e)
            {
                return(new ServiceResponse <m_company>
                {
                    IsSuccess = false,
                    Time = DateTime.UtcNow,
                    Message = e.StackTrace,
                    Data = null
                });
            }
        }