Advertisement
vvsvvs

Untitled

Mar 16th, 2023
371
0
175 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. namespace CarDealer.DTOs.Import
  2. {
  3.     using CarDealer.Models;
  4.     using Newtonsoft.Json;
  5.  
  6.     [JsonObject]
  7.     public class ImportsPartsDto
  8.     {
  9.         [JsonProperty("name")]
  10.         public string Name { get; set; }
  11.  
  12.         [JsonProperty("price")]
  13.         public decimal Price { get; set; }
  14.  
  15.         [JsonProperty("quantity")]
  16.         public int Quantity { get; set; }
  17.  
  18.         [JsonProperty("supplierId")]
  19.         public int SupplierId { get; set; }
  20.  
  21.         public void FromPart(Part part)
  22.         {
  23.             this.Name = part.Name;
  24.             this.Price = part.Price;
  25.             this.Quantity = part.Quantity;
  26.             this.SupplierId = part.SupplierId;
  27.         }
  28.  
  29.         public Part ToPart()
  30.         {
  31.             Part part = new Part();
  32.  
  33.             part.Name = this.Name;
  34.             part.Price = this.Price;
  35.             part.Quantity = this.Quantity;
  36.             part.SupplierId = this.SupplierId;
  37.  
  38.             return part;
  39.         }
  40.     }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement