예제 #1
0
        public void BizAction(PunchCategoryDto inputData)
        {
            var formDictioanry = _dbAccess.GetPunchCategory(inputData.Id);

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

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

            CombineErrors(status);

            Message = $"punch Category is update: {formDictioanry.ToString()}.";
        }
        public PunchCategory BizAction(PunchCategoryDto inputData)
        {
            if (string.IsNullOrWhiteSpace(inputData.Name))
            {
                AddError("Punch Category Name is Required.");
                return(null);
            }

            var desStatus = PunchCategory.CreatePunchCategory(inputData.Name, inputData.ProjectId);

            CombineErrors(desStatus);

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

            return(HasErrors ? null : desStatus.Result);
        }