Ejemplo n.º 1
0
        /// <summary>
        /// Добавить/Изменить связи для Person c Id = <paramref name="pesonId"/>
        /// </summary>
        /// <param name="pesonId"></param>
        /// <param name="models"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public ServiceResponce UpdateConnection(int pesonId, IEnumerable <PersonConnectionModel> models, int userId)
        {
            var result = _personRepository.AddConnections(
                models.Select(o => new PersonConnection
            {
                Id                 = o.Id,
                id_Person          = pesonId,
                id_ConnectionType  = o.id_ConnectionType,
                id_Event           = o.id_Event,
                id_PersonConnectTo = o.id_PersonConnectTo,
                Description        = o.Description
            }).ToList(), userId);

            return(result ? ServiceResponce
                   .FromSuccess()
                   .Result("Connections save complete") :
                   ServiceResponce
                   .FromFailed()
                   .Result($"Error save connections"));
        }