Пример #1
0
        public async Task <ActionResult> ShowAppointments()
        {
            OtherWorker u = (OtherWorker)Session["currentUser"];
            List <LaboratoryAppointment> apps = await db.LaboratoryAppointments.Where(la => la.LaboratoryAnalysis.IdLaboratory == u.IdInstitution).ToListAsync();

            return(View(apps));
        }
Пример #2
0
        public async Task <RedirectToRouteResult> AddLaborant(OtherWorker ow, HttpPostedFileBase photo)
        {
            ow.SetPhoto(photo);
            db.OtherWorkers.Add(ow);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index", "Cabinet"));
        }
        public async Task <RedirectToRouteResult> RemoveModerator(int idModerator)
        {
            OtherWorker moderator = await db.OtherWorkers.FindAsync(idModerator);

            db.OtherWorkers.Remove(moderator);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index", "Cabinet"));
        }
Пример #4
0
        public async Task <RedirectToRouteResult> AddAdmin([Bind(Exclude = "Password")] OtherWorker u, HttpPostedFileBase photo)
        {
            string tempPassword = "******";

            u.Password = tempPassword;
            u.SetPhoto(photo);
            db.OtherWorkers.Add(u);
            await db.SaveChangesAsync();

            MailSender send = new MailSender(u.Email);

            send.SendMessageForConfirmAccount(Url.Action("ConfirmEmail", "Cabinet", new { id = u.Id, email = u.Email }, Request.Url.Scheme), tempPassword);
            return(RedirectToAction("Index", "Cabinet"));
        }
        public async Task <RedirectToRouteResult> AddModerator([Bind(Exclude = "Password")] OtherWorker ow, HttpPostedFileBase photo)
        {
            ow.Password = "******";
            if (photo != null)
            {
                byte[] imageData = new byte[photo.ContentLength];
                await photo.InputStream.ReadAsync(imageData, 0, photo.ContentLength);

                ow.Photo = imageData;
                ow.cutPhoto();
            }
            db.OtherWorkers.Add(ow);
            await db.SaveChangesAsync();

            MailSender send = new MailSender(ow.Email);

            send.SendMessageForConfirmAccount(Url.Action("ConfirmEmail", "Cabinet", new { id = ow.Id, email = ow.Email }, Request.Url.Scheme), "temppassword");
            return(RedirectToAction("Index", "Cabinet"));
        }