Ejemplo n.º 1
0
        public ResponseViewModel Add(ActionTypeDto actionTypeDto)
        {
            var response = new ResponseViewModel();

            if (actionTypeDto.CreatedBy != null)
            {
                var user = IsUserHave((int)actionTypeDto.CreatedBy);

                if (!user)
                {
                    response.IsSuccess = false;
                    response.Message   = "User bulunamadı";

                    return(response);
                }
            }

            var actionType = new ActionType()
            {
                Name       = actionTypeDto.Name,
                CreateDate = DateTime.Now,
                CreatedBy  = actionTypeDto.CreatedBy,
            };

            _actionTypeDal.Add(actionType);


            var saving = _actionTypeDal.SaveChanges();

            if (!saving)
            {
                response.IsSuccess = false;
                response.Message   = "ActionType kaydedilirken bir hata oluştu";
                response.Data      = actionType;
            }

            response.Data = "Id : " + actionType.Id;

            return(response);
        }
Ejemplo n.º 2
0
 public IResult Add(ActionType actionType)
 {
     _actionTypeDal.Add(actionType);
     return(new SuccessResult(Messages.Added));
 }