-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathItems.cs
More file actions
55 lines (41 loc) · 1.46 KB
/
Items.cs
File metadata and controls
55 lines (41 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace FashionableFitandFlawless.Models
{
public class Items
{
[Key]
public int ItemId { get; set; }
public string Name { get; set; }
[Display(Name = "Upload Picture")]
[MaxLength]
public string ImagePath { get; set; }
[HiddenInput(DisplayValue = false)]
public byte[] ImageByte { get; set; }
[Required(ErrorMessage = "This field is required")]
[DataType(DataType.Url)]
[UIHint("OpenInNewWindow")]
public string Url { get; set; }
public string Style { get; set; }
public string Style2 { get; set; }
[Required(ErrorMessage = "This field is required")]
[DataType(DataType.Currency)]
public decimal Price { get; set; }
public string Category { get; set; }
public string Season { get; set; }
public string SubCategory { get; set; }
public string Shipping { get; set; }
//public string Note { get; set; }
public void UpdateFromExisting(Items existing)
{
foreach (var prop in GetType().GetProperties().Where(prop => !prop.Name.ToLower().StartsWith("image")))
{
prop.SetValue(this, prop.GetValue(existing));
}
}
}
}