public async Task <ActionResult> Create(int kheechId)
        {
            var moment = new MomentsUploadViewModel
            {
                KheechId = kheechId
            };

            //moment.InsertDate = DateTime.UtcNow;

            return(View(moment));
        }
        public async Task <ActionResult> Create(MomentsUploadViewModel momentupload)
        {
            var currentUserId = User.Identity.GetUserId();

            var allowedExtensions = new[] { ".png", ".jpg", ".gif" };
            var fileExtension     = Path.GetExtension(momentupload.File.FileName).ToLower();

            if (!allowedExtensions.Contains(fileExtension))
            {
                ViewBag.Message = "This FileType is not supported by our site.";
                return(View(momentupload));
            }

            string fileName  = Path.GetFileNameWithoutExtension(momentupload.File.FileName);
            string extension = Path.GetExtension(momentupload.File.FileName);

            fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;

            var path = Server.MapPath("/uploads/");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            momentupload.ImagePath = "/uploads/" + fileName;
            momentupload.File.SaveAs(Path.Combine(path, fileName));

            var momentToBeCreated = new Moment
            {
                KheechEventId     = momentupload.KheechId,
                Description       = momentupload.Description,
                ApplicationUserId = currentUserId,
                Capture           = momentupload.ImagePath,
                InsertDate        = DateTime.UtcNow
            };

            //var momentToBeAdded = new Moment
            //{
            //    FileName = moment.File.FileName,
            //    ContentType = moment.File.ContentType,
            //ContentLength = moment.File.ContentLength,
            //Data = data
            ////}

            _context.Moments.Add(momentToBeCreated);
            await _context.SaveChangesAsync();

            return(RedirectToRoute("MomentsDetail", new { id = momentToBeCreated.Id }));
        }