Hi,
I have one table in database with fiedls like below
Report with fields RId RNo RName RQuery
Initially i have page like this in that i have entered some values like below.
https://ibb.co/HDVNgwx
After that those values can be saved to database like below
RId RNo RName RQuery
1 2 streing select OrderName,OrderDate,RAI_Item,RAI_Quantity,RAI_Price,RAI_Total from Orders5 o inner join Items6 i on o.OrderId=i.OrderId where OrderDate between { FromDate} and {ToDate} and {RAI_Item}
after that i need to click on settings button
after that in grid view i need todisplay like below
Cname Ctype Date
FromDate datepicker/dropdown Currentdate/Yestday
ToDate datepicker/dropdown Currentdate/Yestday
RAI_Item datepicker/dropdown Currentdate/Yestday
if we can look into above my image i have entered 3 values in flower brackets
where ctype static dropdown i am going to assign some static values
like datepicker/dropdown
in the same way for date also same
@{
Layout = null;
}
<html>
<head>
<title></title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.8/angular.min.js"></script>
<script src="~/scripts/dirpagination.js"></script>
<script>
var app = angular.module("myApp", ['angularUtils.directives.dirPagination']);
app.controller("myCntrl", ['$scope', '$http', 'myService', function ($scope, $http, myService) {
$scope.mahesh1 = false;
$scope.mahesh2 = true;
$scope.AddUpdateUser = function () {
debugger;
var User = {
RId: $scope.RId,
RNo: $scope.RNo,
RName: $scope.RName,
RQuery: $scope.RQuery
};
var getAction = $scope.Action;
var getData = myService.AddUser(User);
getData.then(function (msg) {
//GetAllUsers();
alert(msg.data);
$scope.msg = msg.data;
}, function (msg) {
alert(msg.data);
$scope.msg = msg.data;
});
//GetAllUsers();
}
//Add Exchangerate details
$scope.AddUserDiv = function () {
//$scope.mahesh = $scope.mahesh ? false : true;
$scope.mahesh = true;
$scope.mahesh1 = true;
$scope.mahesh2 = false;
//GetAllUsers();
$scope.Action = "Add";
}
$scope.AddUserDiv1 = function () {
$scope.mahesh = false;
$scope.mahesh1 = false;
$scope.mahesh2 = true;
}
}]);
app.service("myService", function ($http) {
this.AddUser = function (user) {
debugger;
var response = $http({
method: "post",
url: "/report1/AddUser",
data: JSON.stringify(user),
dataType: "json"
});
return response;
}
});
</script>
</head>
<body ng-app="myApp" ng-controller="myCntrl">
<div class="container">
<div>
<div id="wrapper" class="clearfix" ng-show="mahesh">
<div class="well">
<form name="userForm" novalidate>
<div class="form-horizontal">
<div class="row">
<div class="col-md-3">
<label for="RNo">RNo</label>
<input type="text" class="form-control" ng-model="RNo" />
</div>
<div class="col-md-3">
<label for="RName">RName</label>
<input type="text" class="form-control" ng-model="RName" />
</div>
<div class="col-md-3">
<label for="RName">ReportQuery</label>
<textarea class="form-control" ng-model="RQuery"></textarea>
</div>
</div>
<div></div>
<div class="form-group" style="width: 120%; text-align: center; padding: 10px;">
<div class="col-md-offset-2 col-md-5">
<p>
<button class="btn btn-success btn-sm" ng-model="IsVisible" ng-click="AddUpdateUser()"><span class="glyphicon glyphicon-ok"></span>Submitt</button>
<button class="btn btn-success btn-sm" ng-model="IsVisible"><span class="glyphicon glyphicon-ok"></span>Settings</button>
</p>
</div>
</div>
</div>
</form>
</div>
</div>
<button class="btn btn-success btn-sm " ng-show="mahesh2" ng-click="AddUserDiv();" style="margin-left: 15px;"><span class="glyphicon glyphicon-plus"></span>Add Country </button>
<button class="btn btn-success btn-sm " ng-show="mahesh1" ng-click="AddUserDiv1();" style="margin-left: 15px;"><span class="glyphicon glyphicon-minus"></span>Add Country </button>
<hr style="width: 550px;" />
<br />
</div>
</div>
</body>
</html>
public string AddUser(Report1 en)
{
if (en != null)
{
try
{
Report1 en1 = new Report1();
en1.RId = en.RId;
en1.RNo = en.RNo;
en1.RName =en.RName;
en1.RQuery = en.RQuery;
db.Report1.Add(en1);
db.SaveChanges();
}
return "Record added Successfully";
}
else
{
return "Addition of Record unsucessfull !";
}
}