public ServiceFrecuency Insert(ServiceFrecuency ServiceFrecuency)
        {
            var id = connection.Query <int>(ServiceFrecuencyQuerys.Insert, ServiceFrecuency).Single();

            ServiceFrecuency.ServiceFrecuencyId = id;
            return(ServiceFrecuency);
        }
Exemple #2
0
        public ServiceResult <ServiceFrecuency> Post([FromBody] ServiceFrecuency model)
        {
            ServiceResult <ServiceFrecuency> result = null;
            var validatorResult = validator.Validate(model);

            if (validatorResult.IsValid)
            {
                try
                {
                    result = this.appService.Insert(model);
                }
                catch (Exception ex)
                {
                    result         = new ServiceResult <ServiceFrecuency>();
                    result.Errors  = new string[] { ex.Message };
                    result.Success = false;
                }
            }
            else
            {
                result         = new ServiceResult <ServiceFrecuency>();
                result.Errors  = validatorResult.GetErrors();
                result.Success = false;
            }

            return(result);
        }
        public ServiceResult <ServiceFrecuency> Update(ServiceFrecuency serviceFrecuency)
        {
            ServiceFrecuency ServiceFrecuencyExist = this.repository.GetServiceFrecuencyByNameWithoutId(serviceFrecuency.ServiceFrecuencyId, serviceFrecuency.Name);

            if (ServiceFrecuencyExist == null)
            {
                var updated = this.repository.Update(serviceFrecuency);
                return(new ServiceResult <ServiceFrecuency>
                {
                    Success = true,
                    Result = updated
                });
            }

            return(new ServiceResult <ServiceFrecuency>
            {
                Success = false,
                Errors = new string[] { MessageError.NameServiceFrecuencyExists }
            });
        }
        public ServiceResult <ServiceFrecuency> Insert(ServiceFrecuency serviceFrecuency)
        {
            ServiceFrecuency ServiceFrecuencyExist = this.repository.GetServiceFrecuencyByName(serviceFrecuency.Name);

            if (ServiceFrecuencyExist == null)
            {
                var ServiceFrecuencyInserted = this.repository.Insert(serviceFrecuency);
                return(new ServiceResult <ServiceFrecuency>
                {
                    Success = true,
                    Result = ServiceFrecuencyInserted
                });
            }

            return(new ServiceResult <ServiceFrecuency>
            {
                Success = false,
                Errors = new string[] { MessageError.NameServiceFrecuencyExists }
            });
        }
Exemple #5
0
 public ServiceResult <ServiceFrecuency> Update(ServiceFrecuency ServiceFrecuency)
 {
     return(this.service.Update(ServiceFrecuency));
 }
Exemple #6
0
 public ServiceResult <ServiceFrecuency> Insert(ServiceFrecuency ServiceFrecuency)
 {
     return(this.service.Insert(ServiceFrecuency));
 }
        public ServiceFrecuency Update(ServiceFrecuency ServiceFrecuency)
        {
            var affectedRows = connection.Execute(ServiceFrecuencyQuerys.Update, ServiceFrecuency);

            return(ServiceFrecuency);
        }