public IEnumerable <WeatherForecast> Get()
        {
            OtherHelper o = new OtherHelper();

            o.Sendmail("*****@*****.**", "Hello", "Message");
            var rng = new Random();

            return(Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                Date = DateTime.Now.AddDays(index),
                TemperatureC = rng.Next(-20, 55),
                Summary = Summaries[rng.Next(Summaries.Length)]
            })
                   .ToArray());
        }
        public async Task <IActionResult> PostStudentInfo([FromBody] StudentInfo studentInfo, IFormFile photo, IFormFile sign)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            OtherHelper oh   = new OtherHelper();
            string      path = _ev.WebRootPath;

            if (photo != null)
            {
                string photofolder = path + "public/studentimage";
                var    ph          = oh.SaveFil(photo, photofolder, studentInfo.Photo);
                studentInfo.Photo = ph;
            }
            if (sign != null)
            {
                string signfolder = path + "public/studentsign";
                var    si         = oh.SaveFil(sign, signfolder, studentInfo.Signature);
                studentInfo.Signature = si;
            }

            bool IstransactionComplete = false;

            using (var transaction = _context.Database.BeginTransaction())
            {
                try
                {
                    if (studentInfo.Id > 0)
                    {
                        _context.Entry(studentInfo).State = EntityState.Modified;
                    }
                    else
                    {
                        _context.StudentInfos.Add(studentInfo);
                        var user = new User
                        {
                            UserName = studentInfo.Email,
                            Email    = studentInfo.Email
                        };
                        var pass   = "******";
                        var result = await _userManager.CreateAsync(user, pass);

                        if (result.Succeeded)
                        {
                            string mess = string.Format("{0} Account created successfuly . Your Usen Name : {1} and Password : {2}", studentInfo.StudentName, user.UserName, pass);
                            var    p    = oh.Sendmail(user.Email, "Account Registration Success", mess);
                        }
                        _context.SaveChanges();
                        transaction.Commit();
                        IstransactionComplete = true;
                    }
                }
                catch (Exception e)
                {
                    IstransactionComplete = false;
                    return(Problem(e.Message));
                }
            }
            _context.StudentInfos.Add(studentInfo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetStudentInfo", new { id = studentInfo.Id, status = IstransactionComplete }, studentInfo));
        }