forked from mak098/san-salvador
-
Notifications
You must be signed in to change notification settings - Fork 0
/
something.txt
28 lines (27 loc) · 1.76 KB
/
something.txt
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
public void update(ProductController obj)
{
Services.Validator validator = new Services.Validator();
if (validator.isNotEmpty(obj.fields["name"]))
{
if (validator.isNotEmpty(obj.fields["marqueId"]))
{
if (validator.isFloat(obj.fields["minPrice"]) && validator.isFloat(obj.fields["maxPrice"]))
{
Models.Objects.ProductObject product_obj = new Models.Objects.ProductObject();
product_obj.Name = obj.fields["name"];
product_obj.Description = obj.fields["description"];
product_obj.MinPrice = Convert.ToDouble(obj.fields["minPrice"]);
product_obj.MaxPrice = Convert.ToDouble(obj.fields["maxPrice"]);
product_obj.MarqueId = Convert.ToInt16(obj.fields["marqueId"]);
product_obj.Id = obj.fields["id"];
product_obj.UserId = Convert.ToInt16(Services.Session.userSession["id"]);
Models.Produit mark_model = new Models.Produit();
mark_model.update(product_obj);
message = mark_model.callback;
}
else message = new Dictionary<string, string> { { "type", "failure" }, { "message", "Le prix minimum et le prx max doivent etre de type decimal" } };
}
else message = new Dictionary<string, string> { { "type", "failure" }, { "message", "Veillez choisir la marque a la quelle appartien le produi svp !!!" } };
}
else message = new Dictionary<string, string> { { "type", "failure" }, { "message", "Le nom du produit est obligatoire" } };
}