예제 #1
0
 public void UpdatePartnerPayment(PartnerPaymentViewModel partnerPayment)
 {
     if (partnerPayment.ObjectI == "P")
     {
         var updatePartnerPayment = Mapper.Map <PartnerPaymentViewModel, PartnerPayment_D>(partnerPayment);
         _partnerPaymentRepository.Update(updatePartnerPayment);
     }
     else if (partnerPayment.ObjectI == "S")
     {
         var updateSupplierPayment = Mapper.Map <PartnerPaymentViewModel, SupplierPayment_D>(partnerPayment);
         _supplierPaymentRepository.Update(updateSupplierPayment);
     }
     SavePartnerPayment();
 }
        public IActionResult Update(string id, [FromBody] PartnerPayment PartnerPayment)
        {
            var claims = User.Claims.Select(claim => new { claim.Type, claim.Value }).ToDictionary(t => t.Type, t => t.Value);

            if (claims.ContainsKey("name"))
            {
                if (claims["name"].Equals("ADMIN") || claims["name"].Equals("MANAGER"))
                {
                    return(Ok(_repository.Update(id, PartnerPayment)));
                }
            }
            else
            {
                return(Forbid());
            }
            return(Forbid());
        }
 public IActionResult Update(string id, [FromBody] PartnerPayment PartnerPayment)
 {
     return(Ok(_repository.Update(id, PartnerPayment)));
 }