I create a new form and I want view name based on id in another table, but the id can't view in the dropdown list:
This is the view:
<div class="form-group">
<label class="control-label col-md-2">ID Operator</label>
<div class="col-md-10">
#Html.DropDownList("idOp", null, htmlAttributes: new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.idOp, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2">Name</label>
<div class="control-label col-md-10">
#Html.EditorFor(model => model.tbl_operator.nama, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.tbl_operator.nama , "", new { #class = "text-danger" })
</div>
</div>
This is the controller :
public ActionResult Create()
{
ViewBag.idEx = new SelectList(db.tbl_exercises, "idEx");
ViewBag.idOp = new SelectList(db.tbl_operator, "idOp");
return View();
}
Maybe I'm missing the code.
You need choose what field is Name, Value for SelectList like
ViewBag.idEx = new SelectList(tbl_exercises, "Value", "Name");
I made an example base on your code
var tbl_exercises = new List<exercises>
{
new exercises
{
Name = "Name 1",
Value = 10
},
new exercises
{
Name = "Name 2",
Value = 11
}
};
ViewBag.idEx = new SelectList(tbl_exercises, "Value", "Name");
SelectList is defined as
public SelectList(IEnumerable items, string dataValueField, string dataTextField);
In your controller, try to use
ViewBag.idOp = new SelectList(db.tbl_operator, "idOp","idOp");
Related
I asked a question yesterday about how to fix a sudden and unexpected "Object not set to an instance of an object" error. The only real answer I got was to pass a new instance of the object to the view like this:
// GET: WC_Inbox/Create
public ActionResult Create(int? id)
{
System.Diagnostics.Debug.WriteLine("Employee ID was: " + id);
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Employee employee = db.Employees.Find(id);
if (employee == null)
{
return HttpNotFound();
}
string fullName = employee.First_Name + " " + employee.Last_Name;
System.Diagnostics.Debug.WriteLine("Employee full name: " + fullName);
ViewBag.EmployeeID = id;
ViewBag.Name = fullName;
ViewBag.Status = "Pending";
return View(new WC_Inbox());
}
With the primary line in question being here: return View(new WC_Inbox());
This worked, however it has created further issues. Now on my create page I am given some incorrect data in some fields
The fields Org Number, Hire Date, Work Schedule, and Injury date should not show those values. Those are incorrect and will be very confusing to the mostly elderly client bass the app is intended for. I would like for the placeholder values to show up there rather than this incorrect data.
This is the code from the Create view for those fields:
<div class="form-group">
#Html.LabelFor(model => model.Org_Number, "Org Number", htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Org_Number, new { htmlAttributes = new { #class = "form-control", placeholder = "0025" } })
#Html.ValidationMessageFor(model => model.Org_Number, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.Hire_Date, "Hire Date", htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Hire_Date, new { htmlAttributes = new { #class = "form-control", placeholder = "8/3/2021" } })
#Html.ValidationMessageFor(model => model.Hire_Date, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.Job_Title, "Job Title", htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Job_Title, new { htmlAttributes = new { #class = "form-control", placeholder = "Programmer Analyst" } })
#Html.ValidationMessageFor(model => model.Job_Title, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.Work_Schedule, "Work Schedule", htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Work_Schedule, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.Work_Schedule, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.Injury_Date, "Injury Date", htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Injury_Date, new { htmlAttributes = new { #class = "form-control", placeholder = "8/14/2021" } })
#Html.ValidationMessageFor(model => model.Injury_Date, "", new { #class = "text-danger" })
</div>
</div>
How can I get rid of that bad data and use the placeholder values I assigned instead?
PS: Work Schedule should simply be blank. There is no placeholder value.
The issue is that you are passing a default object to the strongly-typed view. On the line:
return View(new WC_Inbox());
you have not done anything to initialize the properties/values on the WC_Inbox object. This means that all the values will be the default value (0 for int, null for string, the minimum date time for DateTime, etc.) It is those default values that you are seeing on your view. If you would like blank default values, you just have to update the WC_Inbox class to support nullable types. This works because null values display as blanks, so your placeholder text will show up. For example, it worked as expected for Job_Title since Job_Title is a string and its default value is null which is then displayed as a blank by EditorFor which allows the placeholder text to display. Hopefully that makes sense - it is simple, but verbose to explain.
If your WC_Inbox class can allow for nullable values, update it and then your placeholders would work. So the class now looks like:
class WC_Inbox
{
public int? Org_Number {get; set;}
public DateTime? Hire_Date { get; set;}
public string Job_Title {get; set;} // string is nullable already
public DateTime? Work_Schedule {get; set;}
public DateTime? Injury_Date {get; set;}
}
If you update the definition of WC_Inbox then the code as you have it will work.
I'm trying to pass value from a view bag to the view create.
Controller
public ActionResult Create()
{
ViewBag.BanhoTosaId = new SelectList(db.BanhoTosas, "BanhoTosaId", "Tipo");
if (ViewBag.BanhoTosaId.SelectedValue != null)
{
BanhoTosa BT = db.BanhoTosas.Find(ViewBag.BanhoTosaId);
decimal valorSoma = BT.Valor + 10;
ViewBag.Total = valorSoma;
}
else
{
ViewBag.Total = 0;
}
return View();
}
view
<div class="form-group">
#Html.LabelFor(model => model.Total, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Total, new { htmlAttributes = new { #class = "form-control", value = "#ViewBag.Total" } })
#Html.ValidationMessageFor(model => model.Total, "", new { #class = "text-danger" })
</div>
</div>
In case BT will get the value in the BanhoTosa table and add 10, and then will return the value of the sum in the viewbag.Total.
But in view the #Html.EditorFor is receiving nothing
How can i do for the editorfor receive the value from the viewbag.total?
Thank's Guy's
I've been trying to display my edit values in the editContact page. I ran out of ideas as to how I'm supposed to fix this.
Here's my controller for edit
[HttpGet]
public ActionResult editContact(int? id)
{
var databaseModel = new database();
if (id == null)
{
return RedirectToAction("Index");
}
IEnumerable<contact> contact = databaseModel.displayContact(id);
return View(contact);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult editContact(contact editModel, int id)
{
try
{
programEntities db = new programEntities();
var databaseModel = new database();
if (databaseModel.editContact(editModel, id))
{
ViewBag.AlertMsg = "Contact edited successfully";
return RedirectToAction("Index");
}
return View();
}
catch (Exception ex)
{
return View(ex);
}
}
In my model, I have this code that controls the database manipulation
public List<contact> displayContact(int? Id)
{
using (SqlConnection conn = new SqlConnection(connectionString))
using (SqlCommand comObj = new SqlCommand("displayContact", conn))
{
comObj.CommandType = CommandType.StoredProcedure;
comObj.Parameters.Add(new SqlParameter("#contactId", Id));
conn.Open();
List<contact> contactList = new List<contact>();
SqlDataAdapter da = new SqlDataAdapter(comObj);
DataTable dt = new DataTable();
//conn.Open();
da.Fill(dt);
conn.Close();
contactList = (from DataRow dr in dt.Rows
select new contact()
{
contactId = Convert.ToInt32(dr["contactId"]),
establishmentType = Convert.ToString(dr["establishmentType"]),
ownerName = Convert.ToString(dr["ownerName"]),
address = Convert.ToString(dr["address"]),
city = Convert.ToString(dr["city"]),
region = Convert.ToString(dr["region"]),
mobileNumber = Convert.ToString(dr["mobileNumber"]),
phoneNumber = Convert.ToString(dr["phoneNumber"])
}).ToList();
return contactList;
}
}
My view markup:
#model directory.Models.contact
#{
ViewBag.Title = "Edit";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Edit</h2>
#using (Html.BeginForm())
{
#Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>contact</h4>
<hr />
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
#Html.HiddenFor(model => model.contactId)
<div class="form-group">
#Html.LabelFor(model => model.establishmentType, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.establishmentType, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.establishmentType, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.ownerName, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.ownerName, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.ownerName, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.address, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.address, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.address, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.city, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.city, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.city, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.region, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.region, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.region, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.mobileNumber, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.mobileNumber, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.mobileNumber, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.phoneNumber, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.phoneNumber, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.phoneNumber, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
#Html.ActionLink("Back to List", "Index")
</div>
#section Scripts {
#Scripts.Render("~/bundles/jqueryval")
}
I tried creating a different query to display the edit values, but the exception says my dispayContact stored procedure does not exist even though it does. My other stored procedure works well except for this one.
Edit
So I fixed my stored procedure in SQL Server; it was named "dispayContact". Still the edit values won't display even after adding firstOrDefault() and then changing the declaration in my view from #model directory.Models.contact to #model IEnumerable<directory.Models.contact>
I think the issue is because you are returning a list
return View(contact);
where contact is IEnumerable<contact> and your view model is
#model directory.Models.contact
I guess your code should work once you return the model not list contain the model, in your case return FirstOrDefault() of your contact list
something like this
return View(contact.FirstOrDefault());
There are few issues with your function. You can use datareader which is much faster than data adopter. You also don't need to return a collection but just an object of your type:
Function to get object:
public contact displayContact(int? Id)
{
using (SqlConnection conn = new SqlConnection(connectionString))
{
using (SqlCommand comObj = new SqlCommand("displayContact", conn))
{
comObj.CommandType = CommandType.StoredProcedure;
comObj.Parameters.Add(new SqlParameter("#contactId", Id));
conn.Open();
using (SqlDataReader dr = comObj.ExecuteReader())
{
while (dr.Read())
{
return new contact
{
contactId = int.Parse(dr["contactId"].ToString()),
establishmentType = dr["establishmentType"].ToString(),
ownerName = dr["ownerName"].ToString(),
address = dr["address"].ToString(),
city = dr["city"].ToString(),
region = dr["region"].ToString(),
mobileNumber = dr["mobileNumber"].ToString(),
phoneNumber = dr["phoneNumber"].ToString()
};
}
}
}
conn.Close();
}
return null;
}
Controller Action:
public ActionResult editContact(int? id)
{
var databaseModel = new database();
if (id == null)
{
return RedirectToAction("Index");
}
var contact = databaseModel.displayContact(id);
return View(contact);
}
This question already has answers here:
The ViewData item that has the key 'XXX' is of type 'System.Int32' but must be of type 'IEnumerable<SelectListItem>'
(6 answers)
Closed 5 years ago.
I'm getting the following error:
There is no ViewData item of type 'IEnumerable' that has the key 'Category'.
Line 34:div class="form-group">
Line 35:
Line 36:#Html.DropDownList("Category", (IEnumerable)ViewBag.DropdownValues,"Select Category", new { #class = "form-control" })
Line 37:
Line 38:
Model:
public class CateogryList
{
public string categoryValues { get; set; }
public IEnumerable<SelectListItem> categoryValuesList { get; set; }
}
Controller:
public ActionResult CreateService()
{
CateogryList cate = new CateogryList();
ServiceProviderRepository values = new ServiceProviderRepository();
List<string> details = new List<string>(values.displayCateogry());
var types = new List<SelectListItem>();
int counter = 0;
foreach (string val in details)
{
types.Add(new SelectListItem() { Text = val, Value = Convert.ToString(counter) });
counter += 1;
}
ViewBag.DropdownValues = new SelectList(details, cate.categoryValues, "");
return View();
}
[HttpPost]
public ActionResult CreateService(ServicesViewModel addService, FormCollection form)
{
ViewData["SelectedItem"] = form["Category"].ToString();
// ViewData["SelectedItem"] = HttpContext.Request.QueryString["Category"];
return View();
}
Servicerepository:
public class ServiceProviderRepository
{
private SqlConnection con;
/*
* To Handle Database connection related activities
* #parameter: No parameter
*/
private void connection()
{
string constr = ConfigurationManager.ConnectionStrings["Event_Database"].ToString();
con = new SqlConnection(constr);
}
public List<string> displayCateogry()
{
List<string> list = new List<string>();
connection();
string SQLquery = "Select Category from category";
SqlCommand com1 = new SqlCommand(SQLquery, con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(com1);
DataTable dt = new DataTable();
da.Fill(dt);
foreach(DataRow row in dt.Rows)
{
list.Add(row.Field<string>(0));
}
return list;
}
}
View:
#model Event_Planner_MVC_Application.Models.ServicesViewModel
#{
ViewBag.Title = "CreateService";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Create Service</h2>
#using (Html.BeginForm("CreateService", "ServiceProvider", FormMethod.Post))
{
#Html.AntiForgeryToken()
<h3>You have Selected: #ViewData["SelectedItem"]</h3>
<div class="form-horizontal">
<h4>ServicesViewModel</h4>
<hr />
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
<div class="form-group">
#Html.LabelFor(model => model.Description, htmlAttributes: new {
#class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Description, new { htmlAttributes
= new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.Description, "", new {
#class = "text-danger" })
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.Cost, htmlAttributes: new { #class =
"control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.Cost, new { htmlAttributes = new
{ #class = "form-control" } })
#Html.ValidationMessageFor(model => model.Cost, "", new { #class
= "text-danger" })
</div>
</div>
<div class="form-group">
<div class="form-group">
#Html.DropDownList("Category",
(IEnumerable<SelectListItem>)ViewBag.DropdownValues,"Select Category", new {
#class = "form-control" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
In your Controller change ViewBag.DropdownValues to ViewBag.Category and in View
Controller
ViewBag.Category= new SelectList(details, cate.categoryValues, "");
View
#Html.DropDownList("Category",
(IEnumerable<SelectListItem>)ViewBag.Category,"Select Category", new {
#class = "form-control" })
I have a view which gets username and password and needs to pass it to the Database. I can pass the username but not the password.
View:
<div class="form-group">
#Html.LabelFor(m => m.UserName, new { #class = "label-control" })
#Html.PasswordFor(m => m.UserName, new { #class = "form-control", autofocus = "", value = "Text" })
#Html.ValidationMessageFor(m => m.UserName, null, new { #class = "alert-danger" })
</div>
<div class="form-group">
#Html.LabelFor(m => m.Password, new { #class = "label-control" })
#Html.TextBoxFor(m => m.Password, new { #class = "form-control" })
#Html.ValidationMessageFor(m => m.Password, null, new { #class = "alert-danger" })
</div>
Controller:
public ActionResult EditUserSubmit(string UserName, string Password, string ProcessType)
{
string process;
string name = Url.RequestContext.RouteData.Values["id"].ToString();
process = (ProcessType == "Processed") ? "P" : "B";
DB.Entities.user users = db.users.Where(m => m.username == name).FirstOrDefault();
users.password = Password;
users.processtype = process;
db.SaveChanges();
return RedirectToAction("Manager");
}
UPDATE
This is the whole View
#model NV.Tax.SST.Gateway.MVC.Models.AdministrationModel
#{string name = Url.RequestContext.RouteData.Values["id"].ToString();}
<div class="x-form-wrapper">
<div class="x-form-title">
<h3><strong>User Detail for <b>#Url.RequestContext.RouteData.Values["id"]</b></strong></h3>
</div>
<div class="x-form-body">
<div class="form-group">
#Html.LabelFor(m => m.UserName, new { #class = "label-control" })
#Html.TextBoxFor(m => m.UserName, new { #class = "form-control", autofocus = "", value = "Text" })
#Html.ValidationMessageFor(m => m.UserName, null, new { #class = "alert-danger" })
</div>
<div class="form-group">
#Html.LabelFor(m => m.Password, new { #class = "label-control" })
#Html.PasswordFor(m => m.Password, new { #class = "form-control" })
#Html.ValidationMessageFor(m => m.Password, null, new { #class = "alert-danger" })
</div>
<div class="form-group">
#Html.LabelFor(m => m.ProcessType, new { #class = "label-control" })
#Html.DropDownListFor(m => m.ProcessType, new[]{
new SelectListItem { Text = "Processed", Value = "Processed" },
new SelectListItem { Text = "Both", Value = "Both" }
}, new { #class = "form-control" })
#Html.ValidationMessageFor(m => m.ProcessType, null, new { #class = "alert-danger" })
</div>
<div class="form-group">
Save
#Html.ActionLink("Cancel", "Manager", "Administration", null, new { #class = "btn btn-lg btn-default" })
</div>
</div>
</div>
#{
string password = "";
var entity = new NV.Tax.SST.Gateway.DB.Entities.sstpEntities();
var data = from db in entity.users
where db.username == name
select db;
foreach(var item in data)
{
password = item.password;
<script>document.getElementById("Password").defaultValue = "#password"</script>
if (item.processtype == "B")
{
<script>document.getElementById("ProcessType").value = "Both"</script>
}
else
{
<script>document.getElementById("ProcessType").value = "Processed"</script>
}
}
}
Since you're creating the password textbox like this
#Html.TextBoxFor(m => m.Password, new { #class = "form-control" })
It's clear that you're using a view model class that has UserName and Password property. I'd guess that it also has ProcessType property. Since you have the following syntax at the top of your view
#model NV.Tax.SST.Gateway.MVC.Models.AdministrationModel
You can use NV.Tax.SST.Gateway.MVC.Models.AdministrationModel as the parameter of your controller action method as below
public ActionResult EditUserSubmit(NV.Tax.SST.Gateway.MVC.Models.AdministrationModel model)
{
string process;
string name = Url.RequestContext.RouteData.Values["id"].ToString();
process = (model.ProcessType == "Processed") ? "P" : "B";
DB.Entities.user users = db.users.Where(m => m.username == name).FirstOrDefault();
users.password = model.Password;
users.processtype = process;
db.SaveChanges();
return RedirectToAction("Manager");
}
The value of model.Password will be what you enter in the password textbox.
EDIT
After looking at the whole view code, this is where you're wrong
Save
You can't submit the page using an anchor tag and without <form> tag. You need to have a <form> tag and a submit button inside it. The <form> tag can be generated using Html.BeginForm helper method. Change your view code to below
#model NV.Tax.SST.Gateway.MVC.Models.AdministrationModel
#{string name = Url.RequestContext.RouteData.Values["id"].ToString();}
<div class="x-form-wrapper">
<div class="x-form-title">
<h3><strong>User Detail for <b>#Url.RequestContext.RouteData.Values["id"]</b></strong></h3>
</div>
<div class="x-form-body">
#using (Html.BeginForm("EditUserSubmit", "Administration"))
{
<div class="form-group">
#Html.LabelFor(m => m.UserName, new { #class = "label-control" })
#Html.TextBoxFor(m => m.UserName, new { #class = "form-control", autofocus = "", value = "Text" })
#Html.ValidationMessageFor(m => m.UserName, null, new { #class = "alert-danger" })
</div>
<div class="form-group">
#Html.LabelFor(m => m.Password, new { #class = "label-control" })
#Html.PasswordFor(m => m.Password, new { #class = "form-control" })
#Html.ValidationMessageFor(m => m.Password, null, new { #class = "alert-danger" })
</div>
<div class="form-group">
#Html.LabelFor(m => m.ProcessType, new { #class = "label-control" })
#Html.DropDownListFor(m => m.ProcessType, new[]{
new SelectListItem { Text = "Processed", Value = "Processed" },
new SelectListItem { Text = "Both", Value = "Both" }
}, new { #class = "form-control" })
#Html.ValidationMessageFor(m => m.ProcessType, null, new { #class = "alert-danger" })
</div>
<div class="form-group">
<button type="submit" class="btn btn-lg btn-primary">Save</button>
#Html.ActionLink("Cancel", "Manager", "Administration", null, new { #class = "btn btn-lg btn-default" })
</div>
}
</div>
</div>
#{
string password = "";
var entity = new NV.Tax.SST.Gateway.DB.Entities.sstpEntities();
var data = from db in entity.users
where db.username == name
select db;
foreach(var item in data)
{
password = item.password;
<script>document.getElementById("Password").defaultValue = "#password"</script>
if (item.processtype == "B")
{
<script>document.getElementById("ProcessType").value = "Both"</script>
}
else
{
<script>document.getElementById("ProcessType").value = "Processed"</script>
}
}
}
You should also add [HttpPost] attribute and change your controller action method as below
[HttpPost]
public ActionResult EditUserSubmit(NV.Tax.SST.Gateway.MVC.Models.AdministrationModel model)
{
string process = (model.ProcessType == "Processed") ? "P" : "B";
DB.Entities.user users = db.users.Where(m => m.username == model.UserName).FirstOrDefault();
users.password = model.Password;
users.processtype = process;
db.SaveChanges();
return RedirectToAction("Manager");
}