public async Task <ActionResult <CallerTune> > PostCallerTune(CallerTune callerTune)
        {
            _context.CallerTunes.Add(callerTune);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCallerTune", new { id = callerTune.Id }, callerTune));
        }
Пример #2
0
 public ActionResult ACTIVATE(CallerTune c, transaction_table t)
 {
     if (ModelState.IsValid)
     {
         t.paymentmethod    = c.payment_method;
         t.Transaction_Name = "CALLERTUNE";
         t.Type             = "SONGS";
         t.time             = System.DateTime.Now.ToShortTimeString();
         t.date             = System.DateTime.Now.ToShortDateString();
         t.offer_recharge_consumer_numbers = c.TUNE_CODE;
         db.transaction_table.Add(t);
         if (db.SaveChanges() > 0)
         {
             c.payment_method  = string.Empty;
             c.amount          = string.Empty;
             c.Account_No      = string.Empty;
             db.Entry(c).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             ModelState.Clear();
             Session["TUNE"] = "CALLER TUNE SUCCESSFULLY ACTIVATED";
             return(View());
         }
     }
     else
     {
         Session["CALLER"] = "*ALL FIELDS MUST FILLED";
     }
     return(View());
 }
        public async Task <IActionResult> PutCallerTune(int id, CallerTune callerTune)
        {
            if (id != callerTune.Id)
            {
                return(BadRequest());
            }

            _context.Entry(callerTune).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CallerTuneExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }