示例#1
0
        public PunchType BizAction(PunchTypeDto inputData)
        {
            if (string.IsNullOrWhiteSpace(inputData.Name))
            {
                AddError("Punch Type Name is Required.");
                return(null);
            }

            if (inputData.WorkPackagepr == null)
            {
                AddError("Please insert value for workpackages percentage");
                return(null);
            }

            var desStatus = PunchType.CreatePunchType(inputData.Name, inputData.ProjectId, inputData.WorkPackagepr);

            CombineErrors(desStatus);

            if (!HasErrors)
            {
                _dbAccess.Add(desStatus.Result);
            }

            return(HasErrors ? null : desStatus.Result);
        }
        public void BizAction(PunchTypeDto inputData)
        {
            var formDictioanry = _dbAccess.GetPunchType(inputData.Id);

            if (formDictioanry == null)
            {
                throw new NullReferenceException("Could not find the punch type. Someone entering illegal ids?");
            }

            var status = formDictioanry.UpdatePunchType(inputData.Name);

            CombineErrors(status);

            Message = $"punch type is update: {formDictioanry.ToString()}.";
        }