Пример #1
0
        public ActionResult Save(ManualBookingModel BookingModel)
        {
            MessageModel msg = new MessageModel();

            try
            {
                HttpPostedFileBase Upload = Request.Files[0];
                var fileName = "";
                if (Request.Files[0].ContentLength > 0)
                {
                    fileName = Path.GetFileName(Upload.FileName);
                    var path = Path.Combine(Server.MapPath("~/Attachments"), fileName);

                    Upload.SaveAs(path);
                }
                BookingModel.AttachmentPath = fileName;
                ManualBookingService bkService = new ManualBookingService();
                msg = bkService.Save(BookingModel, "ripl", 123);
            }
            catch (Exception ex)
            {
                msg.MessageId = 1;
                msg.Message   = ex.Message;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }