public JObject Create(TreatmentHistory treatmentHistory, string filmDocuments = "") { treatmentHistory.DateCreated = DateTime.UtcNow; treatmentHistory.DoctorId = User.UserId; _db.TreatmentHistories.Add(treatmentHistory); _db.SaveChanges(); if (!string.IsNullOrEmpty(filmDocuments)) { JArray filmDocumentsJson = JArray.Parse(filmDocuments) as JArray; foreach (dynamic filmDocumentJson in filmDocumentsJson) { var fileName = DateTime.Now.Ticks + ".png"; var path = HttpContext.Server.MapPath("~/Content/Image/FilmDocument/" + fileName); string imgBase64 = filmDocumentJson.ImgBase64; filmDocumentBO.SaveFilmDocumentFromBase64String(imgBase64, path); FilmDocument filmDocument = new FilmDocument { Conclusion = filmDocumentJson.Conclusion, Description = filmDocumentJson.Description, FilmTypeId = filmDocumentJson.FilmTypeId, TreatmentHistoryId = treatmentHistory.TreatmentHistoryId, ImagePath = fileName, DoctorId = User.UserId, DateCreated = DateTime.UtcNow }; _db.FilmDocuments.Add(filmDocument); } } _db.SaveChanges(); dynamic result = new JObject(); result.result = "ok"; return result; }
public ActionResult CreateForTreatment(int treatmentHistoryId) { var filmTypeList = _db.FilmTypes.ToList(); ViewBag.FilmTypeId = new SelectList(filmTypeList, "FilmTypeId", "Name"); var filmDocument = new FilmDocument { TreatmentHistoryId = treatmentHistoryId, DoctorId = User.UserId }; return PartialView("_Create", filmDocument); }
public ActionResult CreateForMedicalProfile(int medicalProfileId) { var filmTypeList = _db.FilmTypes.ToList(); ViewBag.FilmTypeId = new SelectList(filmTypeList, "FilmTypeId", "Name"); var filmDocument = new FilmDocument { MedicalProfileId = medicalProfileId, DoctorId = User.UserId }; return PartialView("_Create", filmDocument); }
public JObject Create(FilmDocument filmDocument, HttpPostedFileBase file) { if (file != null) { var fileName = DateTime.Now.Millisecond + "_" + Path.GetFileName(file.FileName); var path = HttpContext.Server.MapPath("~/Content/Image/FilmDocument/" + fileName); var dbPath = fileName; file.SaveAs(path); filmDocument.ImagePath = dbPath; } filmDocument.DateCreated = DateTime.Now; _db.FilmDocuments.Add(filmDocument); _db.SaveChanges(); dynamic result = new JObject(); result.result = "ok"; return result; }
public JObject CreateFromAttachment(FilmDocument filmDocument) { var fileName = DateTime.Now.Ticks + "_" + Path.GetFileName(filmDocument.ImagePath); var path = HttpContext.Server.MapPath("~/Content/Image/FilmDocument/" + fileName); var dbPath = fileName; System.IO.File.Copy(HttpContext.Server.MapPath("~/Content/Upload/" + filmDocument.ImagePath), path); filmDocument.ImagePath = dbPath; filmDocument.DateCreated = DateTime.Now; filmDocument.DoctorId = User.UserId; _db.FilmDocuments.Add(filmDocument); _db.SaveChanges(); dynamic result = new JObject(); result.result = "ok"; return result; }
public ActionResult CreateFromAttachment(string imagePath) { var imageName = Path.GetFileName(imagePath); var filmTypeList = _db.FilmTypes.ToList(); ViewBag.FilmTypeId = new SelectList(filmTypeList, "FilmTypeId", "Name"); var filmDocument = new FilmDocument { ImagePath = imageName }; return PartialView("_CreateFromAttachment", filmDocument); }
public JObject Edit(FilmDocument filmDocument, HttpPostedFileBase file) { if (file != null) { var fileName = DateTime.Now.Millisecond + "_" + Path.GetFileName(file.FileName); var path = HttpContext.Server.MapPath("~/Content/Image/FilmDocument/" + fileName); var dbPath = fileName; file.SaveAs(path); filmDocument.ImagePath = dbPath; } _db.Entry(filmDocument).State = EntityState.Modified; _db.SaveChanges(); dynamic result = new JObject(); result.result = "ok"; return result; }
public ActionResult CreateWhenChat() { var filmTypeList = _db.FilmTypes.ToList(); ViewBag.FilmTypeId = new SelectList(filmTypeList, "FilmTypeId", "Name"); var filmDocument = new FilmDocument { DoctorId = User.UserId }; return PartialView("_CreateWhenChat", filmDocument); }
public JObject CreateFromWebcam(FilmDocument filmDocument, string imgBase64) { var fileName = DateTime.Now.Ticks + ".png"; var path = HttpContext.Server.MapPath("~/Content/Image/FilmDocument/" + fileName); business.SaveFilmDocumentFromBase64String(imgBase64, path); filmDocument.ImagePath = fileName; filmDocument.DateCreated = DateTime.Now; _db.FilmDocuments.Add(filmDocument); _db.SaveChanges(); dynamic result = new JObject(); result.result = "ok"; return result; }