public ActionResult Index(int announ_id) { if (isSaved) { ViewData["isSaved"] = "isSaved"; isSaved = false; } if (notLogin) { ViewData["notLogin"] = "******"; notLogin = false; } var announ_arr = (from a in db.announs where a.id == announ_id select a); iproby.Models.announ_full announ = new iproby.Models.announ_full(); foreach (var item_inside in announ_arr) { announ.description = item_inside.description; announ.header = item_inside.header; announ.announ_id = item_inside.id; announ.about = item_inside.about; announ.about_truncated = TruncateAtWord(item_inside.about, 135); announ.price = item_inside.price; announ.subjects = item_inside.subjects; announ.type_id = item_inside.type_id.Value; } var customer_id_arr = (from a in db.customer_announ where a.announ_id == announ_id select a); int customer_id = 0; DateTime date_from = DateTime.Now; foreach (var item_inside in customer_id_arr) { customer_id = item_inside.customer_id.Value; date_from = item_inside.date_from; } announ.customer_id = customer_id; var contact_id_arr = (from a in db.customers where a.customer_id == customer_id select a.contact_id); int contact_id = 0; foreach (int item_inside in contact_id_arr) { contact_id = item_inside; } var contact_arr = (from a in db.contacts where a.contact_id == contact_id select a); foreach (var item_inside in contact_arr) { announ.first_name = item_inside.first_name; announ.mobile = item_inside.mobile; announ.address = item_inside.address; announ.skype = item_inside.skype; announ.email = item_inside.email; announ.avatar = item_inside.avatar; announ.site = item_inside.site; announ.facebook = item_inside.facebook; announ.icq = item_inside.icq; announ.vkontakte = item_inside.vkontakte; announ.date_from = date_from; } var target_arr = (from a in db.announ_target where a.announ_id == announ_id select a.target_type); string target = string.Empty; foreach (string item in target_arr) { target = item; announ.target = target; } return(View(announ)); }
public ActionResult Index(int announ_id) { if (isSaved) { ViewData["isSaved"] = "isSaved"; isSaved = false; } if (notLogin) { ViewData["notLogin"] = "******"; notLogin = false; } var announ_arr = (from a in db.announs where a.id == announ_id select a); iproby.Models.announ_full announ = new iproby.Models.announ_full(); foreach (var item_inside in announ_arr) { announ.description = item_inside.description; announ.header = item_inside.header; announ.announ_id = item_inside.id; announ.about = item_inside.about; announ.about_truncated = TruncateAtWord(item_inside.about,135); announ.price = item_inside.price; announ.subjects = item_inside.subjects; announ.type_id = item_inside.type_id.Value; } var customer_id_arr = (from a in db.customer_announ where a.announ_id == announ_id select a); int customer_id = 0; DateTime date_from = DateTime.Now; foreach (var item_inside in customer_id_arr) { customer_id = item_inside.customer_id.Value; date_from = item_inside.date_from; } announ.customer_id = customer_id; var contact_id_arr = (from a in db.customers where a.customer_id == customer_id select a.contact_id); int contact_id = 0; foreach (int item_inside in contact_id_arr) { contact_id = item_inside; } var contact_arr = (from a in db.contacts where a.contact_id == contact_id select a); foreach (var item_inside in contact_arr) { announ.first_name = item_inside.first_name; announ.mobile = item_inside.mobile; announ.address = item_inside.address; announ.skype = item_inside.skype; announ.email = item_inside.email; announ.avatar = item_inside.avatar; announ.site = item_inside.site; announ.facebook = item_inside.facebook; announ.icq = item_inside.icq; announ.vkontakte = item_inside.vkontakte; announ.date_from = date_from; } var target_arr = (from a in db.announ_target where a.announ_id == announ_id select a.target_type); string target = string.Empty; foreach (string item in target_arr) { target = item; announ.target = target; } return View(announ); }