So I have this Feedback MVC app I'm working on and one of the final parts I need to do is basically what I mentioned above. I'll give you the quick run down. Main screen, somebody searches a whom they are after and it brings back the result. Upon clicking the desired name it will bringup a form, already auto-completed with the user who searched in the Sender field, and the person who they searched for in the recipient. Brilliant, the form gets sent. Feedback saved to database. Quite basic, but I'm in learning so pretty proud of that.
Now, once the form has been sent I would in turn like an email to get sent to the colleagues manager/supervisor, which I have information on, stored on the database. Now this is no where near finished code and I realise I have a bit of tidying up to do and stuff, but is there a specific place to start looking? Is PHP one of them? Apologies if you don't understand some parts of code obviously with db names etc.
Hope I gave enough info here. There's not much more to overly show in regards to the feedback form.
Feedback form HTML
<h2>Employee Feedback Form</h2>
<div class="container">
@using (Html.BeginForm("Create", "Home", FormMethod.Post, new { @class = "form" }))
{
@Html.AntiForgeryToken()
<div class="row">
<div class="col-25">
<label for="sender">Sender</label>
</div>
<div class="col-75">
@*<input type="text" id="sender" name="sender" readonly="readonly" placeholder="@Html.DisplayFor(model => model.Sender)">*@
@Html.TextBoxFor(model => model.Sender, new { @readonly = "readonly" })
</div>
</div>
<div class="row">
<div class="col-25">
<label for="recep">Recipient</label>
</div>
<div class="col-75">
@Html.TextBoxFor(model => model.Recipient, new { @readonly = "readonly" })
</div>
</div>
<div class="row">
<div class="col-25">
<label for="feedback">Feedback</label>
</div>
<div class="col-75">
@*<textarea id="feedback" name="feedback" placeholder="Write something.." style="height:200px"></textarea>*@
@Html.TextAreaFor(model => model.Comment)
</div>
</div>
<div class="row">
<input type="submit" value="Submit" onclick="return confirm('Are you sure you want to submit feedback?')"/>
</div>
}
</div>
</body>
Feedback Form View Model
public class FeedbackFormViewModel
{
public string Recipient { get; set; }
public string Sender { get; set; }
public string FullName { get; set; }
public string Comment { get; set; }
}
}
Feedback Form Action on Controller
public ActionResult FeedbackForm(string recep, string send)
{
var viewModel = new FeedbackFormViewModel();
viewModel.Recipient = recep;
viewModel.Sender = GetUserFullName();
return View(viewModel);
}
ActionResult to save to database
public ActionResult Create(FeedbackFormViewModel viewModel)
{
if (ModelState.IsValid)
{
var feedback = new THANKYOU
{
SENDER = viewModel.Sender,
RECEIPIENT = viewModel.Recipient,
COMMENT = viewModel.Comment
};
db.THANKYOUs.Add(feedback);
db.SaveChanges();
return RedirectToAction("Index");
}
return View();
}
Really appreciate any help or documentation I could read up on that might help me.
Thanks