Exemplo n.º 1
0
        public Result <int> Add(NaklFullViewModel naklFullViewModel, int userId)
        {
            try
            {
                var addressDataBase = new AddressDataBase(ConnectionStringPattern, Login, Password);
                var naklDataBase    = new NaklDataBase(ConnectionStringPattern, Login, Password);
                var addressId       = addressDataBase.GetCompanyAddresses(userId).First().Id;

                var nakl = new NaklFull()
                {
                    contract_num     = naklFullViewModel.contract_num,
                    contract_type_id = naklFullViewModel.contract_type_id,
                    doc_date         = naklFullViewModel.doc_date,
                    operation_date   = naklFullViewModel.operation_date,
                    provider_id      = naklFullViewModel.provider_id,
                    receiver_id      = addressId,
                    doc_num          = naklFullViewModel.doc_num,
                    receive_type_id  = naklFullViewModel.receive_type_id,
                    source_type_id   = naklFullViewModel.source_type_id,
                    turnover_type_id = naklFullViewModel.turnover_type_id
                };
                return(new Result <int>(naklDataBase.Add(nakl)));
            }
            catch (Exception e)
            {
                return(new Result <int>(e.Message));
            }
        }
Exemplo n.º 2
0
        public Result <object> Update([FromBody] NaklFullViewModel naklFullViewModel)
        {
            var naklService = Create <NaklService>();

            return(naklService.Update(naklFullViewModel, GetUserId()));
        }
Exemplo n.º 3
0
        public Result <int> Add([FromBody] NaklFullViewModel naklFullViewModel)
        {
            var reverseAcceptanceNaklService = Create <ReverseAcceptanceNaklService>();

            return(reverseAcceptanceNaklService.Add(naklFullViewModel, GetUserId()));
        }