Ejemplo n.º 1
0
        public override IResultOperation UpdatetWithRule(Worker obj)
        {
            IResultOperation result  = null;
            string           message = string.Empty;

            obj.Name = obj.Name.Trim();

            IList <Worker> list = this.GetAll().Where(p => p.Name.Equals(obj.Name) && p.ID != obj.ID).ToList();

            if (list.Count() >= 1)
            {
                message = "Esse nome já existe!";
                result  = new OperationResultBusinessLogic(message, ResultOperationStatus.Problem);
                return(result);
            }

            this.baseDataAccessLayer.Insert(obj);

            result = new OperationResultBusinessLogic("Colaborador cadastrado com sucesso", ResultOperationStatus.OK);

            return(result);
        }
Ejemplo n.º 2
0
        public override IResultOperation InsertWithRule(Project obj)
        {
            IResultOperation result  = null;
            string           message = string.Empty;

            obj.Name = obj.Name.Trim();

            IList <Project> list = this.GetAll().Where(p => p.Name.Equals(obj.Name)).ToList();

            if (list.Count() >= 1)
            {
                message = "Esse nome de projeto já existe!";
                result  = new OperationResultBusinessLogic(message, ResultOperationStatus.Problem);
                return(result);
            }

            this.baseDataAccessLayer.Insert(obj);

            result = new OperationResultBusinessLogic("Projeto inserido com sucesso", ResultOperationStatus.OK);

            return(result);
        }