public async Task <IActionResult> Create(Guid id, SingleItemViewVM vm) { var item = await _bll.Items.GetItemViewAsync(id); item.BookingStartDay = vm.BookingStartDay; item.BookingEndDay = vm.BookingEndDay; item.CompanyId = vm.CompanyId; if (vm.BookingStartDay < DateTime.Now) { ModelState.AddModelError(nameof(vm.BookingStartDay), "Booking start date have to be today or future date."); var itemVM = new VMMapper <SingleItemView, SingleItemViewVM>().Map(item); itemVM.CompanySelectList = new SelectList(await _bll.Companies.GetAllAppUserCompaniesAsync(User.UserGuidId()), nameof(CompanyBLL.Id), nameof(CompanyBLL.CompanyName), vm.CompanyId); return(View(itemVM)); } if (vm.BookingEndDay.Subtract(vm.BookingStartDay).Days <= 0) { ModelState.AddModelError(nameof(vm.BookingStartDay), "Booking period cannot be 0 or less."); var itemVM = new VMMapper <SingleItemView, SingleItemViewVM>().Map(item); itemVM.CompanySelectList = new SelectList(await _bll.Companies.GetAllAppUserCompaniesAsync(User.UserGuidId()), nameof(CompanyBLL.Id), nameof(CompanyBLL.CompanyName), vm.CompanyId); return(View(itemVM)); } if (item.AppUserId == User.UserGuidId()) { ModelState.AddModelError(nameof(vm.BookingStartDay), "Item owner can't make a booking."); var itemVM = new VMMapper <SingleItemView, SingleItemViewVM>().Map(item); itemVM.CompanySelectList = new SelectList(await _bll.Companies.GetAllAppUserCompaniesAsync(User.UserGuidId()), nameof(CompanyBLL.Id), nameof(CompanyBLL.CompanyName), vm.CompanyId); return(View(itemVM)); } var bookingBLL = _bll.Bookings.CreateBooking(User.UserGuidId(), item); _bll.Bookings.Add(bookingBLL); await _bll.SaveChangesAsync(); // Add ItemBooked var itemBookedBLL = new ItemBookedBLL(); itemBookedBLL.AppUserId = User.UserGuidId(); itemBookedBLL.DateFrom = vm.BookingStartDay; itemBookedBLL.DateTo = vm.BookingEndDay; itemBookedBLL.ItemId = vm.Id; itemBookedBLL.BookingId = bookingBLL.Id; _bll.ItemsBooked.Add(itemBookedBLL); await _bll.SaveChangesAsync(); return(RedirectToAction(nameof(Create), new { id = id })); }
public ActionResult Index(string p, string m) { ViewBag.ProgramID = VMMapper.MapAreaOfStudy(p); if (m != null && m.ToLower() == "i") { //internal ViewBag.DisplayId = "10103"; ViewBag.CampaignID = "8012"; } else { //external ViewBag.DisplayId = "10586"; ViewBag.CampaignID = "8013"; } return(View()); }
public async Task <IActionResult> Create(Guid id) { var item = await _bll.Items.GetItemViewAsync(id); if (item == null) { return(NotFound(new MessageDTO($"Item with id {id} not found"))); } if (item.Images !.Count == 0) { item.Images = new List <ImageBLL>(); } var itemVM = new VMMapper <SingleItemView, SingleItemViewVM>().Map(item); if (User.Identity.IsAuthenticated) { itemVM.CompanySelectList = new SelectList(await _bll.Companies.GetAllAppUserCompaniesAsync(User.UserGuidId()), nameof(CompanyBLL.Id), nameof(CompanyBLL.CompanyName)); } return(View(itemVM)); }
public static bool Send(HttpRequestBase Request, string firstname, string email, bool isexternal) { EmailManager em = new EmailManager(); EmailTemplateHelper eth = new EmailTemplateHelper(); string body = eth.GetTemplate("welcome"); body = body.Replace("@FirstName", firstname.ToProperCase()); body = body.Replace("@Email", email); StringBuilder sbadditionalinfo = new StringBuilder(); string testresults = CookieDataTestResults.BulletListForEmail(Request); string importantthings = CookieDataImportantThings.BulletListForEmail(Request); if (testresults != "") { sbadditionalinfo.Append("<div class=\"panel\">"); sbadditionalinfo.Append("Your top professions:"); sbadditionalinfo.Append(testresults); sbadditionalinfo.Append("</div>"); } if (importantthings != "") { sbadditionalinfo.Append("<div class=\"panel\">"); sbadditionalinfo.Append("Things that are important to you:"); sbadditionalinfo.Append(importantthings); sbadditionalinfo.Append("</div>"); } body = body.Replace("@AdditionalInfo", sbadditionalinfo.ToString()); string vmcategories = CookieDecoder.DecodeCookieCharacters(Request.Cookies["topvmcategories"].Value); StringBuilder sbvm = new StringBuilder(); if (vmcategories != null && vmcategories != "") { sbvm.Append("In the meantime, check out these schools that can help you achieve your goals in the areas where you excel.<br /><br />"); sbvm.Append("<table border=\"0\" width=\"100%\">"); string[] tokens = vmcategories.Split(','); int cnt = 0; foreach (string vmpid in tokens) { sbvm.Append("<tr>" + "<td style=\"color: #ccc; font-size: 16pt; font-weight: normal; width: 40px; text-align: center\">" + (++cnt) + "</td>" + "<td style=\"padding: 5px;\"><a style=\"font-size: 16pt; font-weight: bold; color: #0099ff; text-decoration: none; margin-bottom: 100px;\" href=\"http://www.SkillCow.com/vm/index?p=" + vmpid + (isexternal ? "&m=e" : "") + "\">" + VMMapper.MapName(vmpid) + " »</a></td>" + "</tr>"); if (cnt > 5) { break; } } sbvm.Append("</table>"); } body = body.Replace("@VMListings", sbvm.ToString()); em.SendMail("*****@*****.**", "SkillCow", email, "Your Test Results", body); return(true); }
public HomeController(IDoctorManager doctorManager, VMMapper vMMapper) { _doctorManager = doctorManager; _vMMapper = vMMapper; }
public PrescriptionController(IDoctorManager doctorManager, VMMapper vMMapper) { _doctorManager = doctorManager; _vMMapper = vMMapper; }