Pages

Wednesday, 21 September 2022

Delete Record Entity Framework C# | ASP.Net MVC

dbConnection db = new dbConnection();

db.WebMsg.Remove(db.WebMsg.Single(x => x.ID == 123));

 Next Topic

Wednesday, 14 September 2022

Update Table CodeIgniter

 $DataModel  =new \App\Models\NewsModel();

$DataModel->set('FileName','jpg');

$DataModel->where('id', 101);

$DataModel->update();


Next Topic

File Upload with new name Codeigniter

 HTML

<form method="post"  action="<?php echo site_url('/Admin/newsadddb'); ?>" enctype="multipart/form-data">

 <input type="file" name="NewsFile" id="NewsFile" style="display:none">

<input type="submit" name="submit" value="Save" class="btn btn-danger" >

</form>

Monday, 12 September 2022

Aggregate Function Entity Framework C#

 Sum 

Get Sum of amount by a select filter using C# MVC Entity Framework


First Method

 dbConnection db = new dbConnection();
 int InvoiceAmount = db.Bill.Where(x => x.CID == 123).Select(i => i.Amount).Sum();


Second Method


data.Where(x => x.msg == "paid").Sum(y => Convert.ToInt32(y.Amount));


Next Topic